@Test public void isFirstBitArrayNotNullWhenInitArray() { viewModel.setArraySize("5"); viewModel.initializeArray(); assertNotNull(viewModel.gitFirstBitArray()); }
@Test public void isFirstBitArraySizeEquals5WhenInputSize5() { viewModel.setArraySize("5"); viewModel.initializeArray(); assertEquals(viewModel.gitFirstBitArray().getSize(), 5); }
@Test public void initArrayAddsMessageToLog() { viewModel.setArraySize("5"); viewModel.initializeArray(); assertFalse(viewModel.getLog().isEmpty()); }
@Test public void isDoOperationEnabledWhenInitArrays() { viewModel.setArraySize("5"); viewModel.initializeArray(); assertTrue(viewModel.isDoOperationEnabled()); }
@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 setSizeArrayAddsMessageToLog() { viewModel.setArraySize("5"); viewModel.logUpdatedSize(); String message = viewModel.getLog().get(viewModel.getLog().size() - 1); assertTrue(message.matches(".*" + ViewModel.LogMessages.UPDATE_ARRAY_SIZE + ".*")); }
private void initArraysForOperations() { viewModel.setArraySize("5"); viewModel.initializeArray(); BitArray firstBitArray = viewModel.getFirstBitArray(); BitArray secondBitArray = viewModel.getSecondBitArray(); firstBitArray.setAll(true); secondBitArray.setAll(false); viewModel.setFirstBitArray(firstBitArray); viewModel.setSecondBitArray(secondBitArray); }
@Test public void isInitArrayEnabledWhenInputValidNumber() { viewModel.setArraySize("11"); assertTrue(viewModel.isInitializeArrayButtonEnabled()); }
@Test public void isEmptyNotificationWhenInputValidNumber() { viewModel.setArraySize("11"); assertEquals(viewModel.getNotification(), ViewModel.Notification.EMPTY_STRING); }
@Test public void isInvalidNumberNotificationWhenInputInvalidNumber() { viewModel.setArraySize("aaaa"); assertEquals(viewModel.getNotification(), ViewModel.Notification.INVALID_NUMBER); }
@Test public void isInitArrayNotEnabledWhenInputInvalidNumber() { viewModel.setArraySize("aaaa"); assertFalse(viewModel.isInitializeArrayButtonEnabled()); }
@Test public void isInitArrayNotEnabledWhenInputEmptyString() { viewModel.setArraySize(""); assertFalse(viewModel.isInitializeArrayButtonEnabled()); }
@Test public void isResultBitArraySizeEquals5WhenInputSize5() { viewModel.setArraySize("5"); viewModel.initializeArray(); assertTrue(viewModel.getResultBitArray().getSize() == 5); }