@Test public void testGetFlashMessage() { final String uuid = "uuid"; final FlashMessage.Type expectedType = WARNING; final String expectedStrongMessage = "expectedStrongMessage"; final String expectedRegularMessage = "expectedRegularMessage"; final String expectedErrorElementSelector = "[data-row-uuid=\"uuid\"] .bootstrap-select"; final Command expectedOnSuccessCallback = mock(Command.class); final Command expectedOnErrorCallback = mock(Command.class); final DataType dataType = mock(DataType.class); final WarningMessage errorMessage = new WarningMessage(translationService) { @Override String getStrongMessage(final DataType dataType) { return expectedStrongMessage; } @Override String getRegularMessage() { return expectedRegularMessage; } }; when(dataType.getUUID()).thenReturn(uuid); final FlashMessage flashMessage = errorMessage.getFlashMessage(dataType, expectedOnSuccessCallback, expectedOnErrorCallback); final FlashMessage.Type actualType = flashMessage.getType(); final String actualStrongMessage = flashMessage.getStrongMessage(); final String actualRegularMessage = flashMessage.getRegularMessage(); final String actualErrorElementSelector = flashMessage.getElementSelector(); final Command actualOnSuccessCallback = flashMessage.getOnSuccess(); final Command actualOnErrorCallback = flashMessage.getOnError(); assertEquals(expectedType, actualType); assertEquals(expectedStrongMessage, actualStrongMessage); assertEquals(expectedRegularMessage, actualRegularMessage); assertEquals(expectedErrorElementSelector, actualErrorElementSelector); assertEquals(expectedOnSuccessCallback, actualOnSuccessCallback); assertEquals(expectedOnErrorCallback, actualOnErrorCallback); }
FlashMessage getFlashMessage(final DataType dataType, final Command onSuccess, final Command onError) { return new FlashMessage(WARNING, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType), onSuccess, onError); }
WarningMessage { FlashMessage getFlashMessage(final DataType dataType, final Command onSuccess, final Command onError) { return new FlashMessage(WARNING, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType), onSuccess, onError); } }
WarningMessage { FlashMessage getFlashMessage(final DataType dataType, final Command onSuccess, final Command onError) { return new FlashMessage(WARNING, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType), onSuccess, onError); } WarningMessage(final TranslationService translationService); }
WarningMessage { FlashMessage getFlashMessage(final DataType dataType, final Command onSuccess, final Command onError) { return new FlashMessage(WARNING, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType), onSuccess, onError); } WarningMessage(final TranslationService translationService);  }
WarningMessage { FlashMessage getFlashMessage(final DataType dataType, final Command onSuccess, final Command onError) { return new FlashMessage(WARNING, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType), onSuccess, onError); } WarningMessage(final TranslationService translationService);   }