コード例 #1
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 + ".*"));
  }
コード例 #2
0
  @Test
  public void updatedSecondBitArrayAddsMessageUpdatedSecondBitArray() {
    initArraysForOperations();
    viewModel.logUpdatedSecondBitArray();

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

    assertTrue(message.matches(".*" + ViewModel.LogMessages.UPDATE_SECOND_BIT_ARRAY + ".*"));
  }
コード例 #3
0
  @Test
  public void initArrayAddsMessageInitArrayWithSize() {
    viewModel.setArraySize("5");

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

    assertTrue(message.matches(".*" + ViewModel.LogMessages.INIT_ARRAY_WITH_SIZE + ".*"));
  }
コード例 #4
0
  @Test
  public void changeOperationNotAddsMessageToLogWithSameOperation() {
    viewModel.setOperation(Operation.XOR);
    int sizeFirst = viewModel.getLog().size();

    viewModel.setOperation(Operation.XOR);

    assertEquals(viewModel.getLog().size(), sizeFirst);
  }
コード例 #5
0
  @Test
  public void setSizeArrayAddsMessageToLog() {
    viewModel.setArraySize("5");
    viewModel.logUpdatedSize();

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

    assertTrue(message.matches(".*" + ViewModel.LogMessages.UPDATE_ARRAY_SIZE + ".*"));
  }
コード例 #6
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 + ".*"));
  }
コード例 #7
0
  @Test
  public void initArrayAddsMessageToLog() {
    viewModel.setArraySize("5");

    viewModel.initializeArray();

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

    viewModel.doOperation();

    assertFalse(viewModel.getLog().isEmpty());
  }
コード例 #9
0
 @Test
 public void isEmptyLogByDefault() {
   assertTrue(viewModel.getLog().isEmpty());
 }
コード例 #10
0
  @Test
  public void changeOperationAddsMessageToLog() {
    viewModel.setOperation(Operation.XOR);

    assertFalse(viewModel.getLog().isEmpty());
  }