@Test public void testGetFlashMessage() { final String uuid = "uuid"; final FlashMessage.Type expectedType = ERROR; final String expectedStrongMessage = "expectedStrongMessage"; final String expectedRegularMessage = "expectedRegularMessage"; final String expectedErrorElementSelector = "[data-row-uuid=\"uuid\"] [data-type-field=\"name-input\"]"; final DataType dataType = mock(DataType.class); final ErrorMessage errorMessage = new ErrorMessage(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); final FlashMessage.Type actualType = flashMessage.getType(); final String actualStrongMessage = flashMessage.getStrongMessage(); final String actualRegularMessage = flashMessage.getRegularMessage(); final String actualErrorElementSelector = flashMessage.getElementSelector(); assertEquals(expectedType, actualType); assertEquals(expectedStrongMessage, actualStrongMessage); assertEquals(expectedRegularMessage, actualRegularMessage); assertEquals(expectedErrorElementSelector, actualErrorElementSelector); }
public FlashMessage getFlashMessage(final DataType dataType) { return new FlashMessage(ERROR, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType)); }
ErrorMessage { public FlashMessage getFlashMessage(final DataType dataType) { return new FlashMessage(ERROR, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType)); } }
ErrorMessage { public FlashMessage getFlashMessage(final DataType dataType) { return new FlashMessage(ERROR, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType)); } ErrorMessage(final TranslationService translationService); }
ErrorMessage { public FlashMessage getFlashMessage(final DataType dataType) { return new FlashMessage(ERROR, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType)); } ErrorMessage(final TranslationService translationService); FlashMessage getFlashMessage(final DataType dataType); }
ErrorMessage { public FlashMessage getFlashMessage(final DataType dataType) { return new FlashMessage(ERROR, getStrongMessage(dataType), getRegularMessage(), getErrorElementSelector(dataType)); } ErrorMessage(final TranslationService translationService); FlashMessage getFlashMessage(final DataType dataType);  }