コード例 #1
0
  @Test
  public void changeOperationNotAddsMessageToLogWithSameOperation() {
    viewModel.setOperation(Operation.XOR);
    int sizeFirst = viewModel.getLog().size();

    viewModel.setOperation(Operation.XOR);

    assertEquals(viewModel.getLog().size(), sizeFirst);
  }
コード例 #2
0
  @Test
  public void changeOperationAddsMessageChangeOperation() {
    viewModel.setOperation(Operation.XOR);
    String message = viewModel.getLog().get(viewModel.getLog().size() - 1);

    assertTrue(message.matches(".*" + ViewModel.LogMessages.OPERATION_CHANGED + ".*"));
  }
コード例 #3
0
 @Test
 public void canDoXorOperation() {
   viewModel.setOperation(Operation.XOR);
   initArraysForOperations();
   viewModel.doOperation();
   assertNotNull(viewModel.getResultBitArray());
 }
コード例 #4
0
  @Test
  public void doOperationAddsMessageToLog() {
    viewModel.setOperation(Operation.XOR);
    initArraysForOperations();

    viewModel.doOperation();

    assertFalse(viewModel.getLog().isEmpty());
  }
コード例 #5
0
  @Test
  public void doOperationAddsMessageDidOperation() {
    viewModel.setOperation(Operation.XOR);
    initArraysForOperations();

    viewModel.doOperation();
    String message = viewModel.getLog().get(viewModel.getLog().size() - 1);

    assertTrue(message.matches(".*" + ViewModel.LogMessages.OPERATION_DID + ".*"));
  }
コード例 #6
0
  @Test
  public void changeOperationAddsMessageToLog() {
    viewModel.setOperation(Operation.XOR);

    assertFalse(viewModel.getLog().isEmpty());
  }
コード例 #7
0
  @Test
  public void canSetOperation() {
    viewModel.setOperation(Operation.AND);

    assertEquals(Operation.AND, viewModel.getOperation());
  }