@Test public void changeOperationAddsMessageChangeOperation() { viewModel.setOperation(Operation.XOR); String message = viewModel.getLog().get(viewModel.getLog().size() - 1); assertTrue(message.matches(".*" + ViewModel.LogMessages.OPERATION_CHANGED + ".*")); }
@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 + ".*")); }
@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 + ".*")); }
@Test public void changeOperationNotAddsMessageToLogWithSameOperation() { viewModel.setOperation(Operation.XOR); int sizeFirst = viewModel.getLog().size(); viewModel.setOperation(Operation.XOR); assertEquals(viewModel.getLog().size(), sizeFirst); }
@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 + ".*")); }
@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 + ".*")); }
@Test public void initArrayAddsMessageToLog() { viewModel.setArraySize("5"); viewModel.initializeArray(); assertFalse(viewModel.getLog().isEmpty()); }
@Test public void doOperationAddsMessageToLog() { viewModel.setOperation(Operation.XOR); initArraysForOperations(); viewModel.doOperation(); assertFalse(viewModel.getLog().isEmpty()); }
@Test public void isEmptyLogByDefault() { assertTrue(viewModel.getLog().isEmpty()); }
@Test public void changeOperationAddsMessageToLog() { viewModel.setOperation(Operation.XOR); assertFalse(viewModel.getLog().isEmpty()); }