@Test public void testGetNameIsNotUniqueFlashMessage() { final BaseIncludedModelActiveRecord includedModel = mock(BaseIncludedModelActiveRecord.class); final Type expectedType = ERROR; final String expectedStrongMessage = "StrongMessage"; final String expectedRegularMessage = "RegularMessage"; final String expectedElementSelector = "[data-card-uuid=\"1234\"] [data-field=\"title-input\"]"; when(includedModel.getUUID()).thenReturn("1234"); when(includedModel.getName()).thenReturn("file"); when(translationService.format(IncludedModelNameIsNotUniqueErrorMessage_StrongMessage, "file")).thenReturn(expectedStrongMessage); when(translationService.format(IncludedModelNameIsNotUniqueErrorMessage_RegularMessage)).thenReturn(expectedRegularMessage); final FlashMessage flashMessage = factory.getNameIsNotUniqueFlashMessage(includedModel); assertEquals(expectedType, flashMessage.getType()); assertEquals(expectedStrongMessage, flashMessage.getStrongMessage()); assertEquals(expectedRegularMessage, flashMessage.getRegularMessage()); assertEquals(expectedElementSelector, flashMessage.getElementSelector()); }
public FlashMessage getNameIsNotUniqueFlashMessage(final BaseIncludedModelActiveRecord includedModel) { return new FlashMessage(ERROR, translate(IncludedModelNameIsNotUniqueErrorMessage_StrongMessage, includedModel.getName()), translate(IncludedModelNameIsNotUniqueErrorMessage_RegularMessage), getErrorElementSelector(includedModel)); }
IncludedModelErrorMessageFactory { public FlashMessage getNameIsNotUniqueFlashMessage(final BaseIncludedModelActiveRecord includedModel) { return new FlashMessage(ERROR, translate(IncludedModelNameIsNotUniqueErrorMessage_StrongMessage, includedModel.getName()), translate(IncludedModelNameIsNotUniqueErrorMessage_RegularMessage), getErrorElementSelector(includedModel)); } }
IncludedModelErrorMessageFactory { public FlashMessage getNameIsNotUniqueFlashMessage(final BaseIncludedModelActiveRecord includedModel) { return new FlashMessage(ERROR, translate(IncludedModelNameIsNotUniqueErrorMessage_StrongMessage, includedModel.getName()), translate(IncludedModelNameIsNotUniqueErrorMessage_RegularMessage), getErrorElementSelector(includedModel)); } @Inject  IncludedModelErrorMessageFactory(final TranslationService translationService); }
IncludedModelErrorMessageFactory { public FlashMessage getNameIsNotUniqueFlashMessage(final BaseIncludedModelActiveRecord includedModel) { return new FlashMessage(ERROR, translate(IncludedModelNameIsNotUniqueErrorMessage_StrongMessage, includedModel.getName()), translate(IncludedModelNameIsNotUniqueErrorMessage_RegularMessage), getErrorElementSelector(includedModel)); } @Inject  IncludedModelErrorMessageFactory(final TranslationService translationService); FlashMessage getNameIsNotUniqueFlashMessage(final BaseIncludedModelActiveRecord includedModel); FlashMessage getNameIsBlankFlashMessage(final BaseIncludedModelActiveRecord includedModel); }
IncludedModelErrorMessageFactory { public FlashMessage getNameIsNotUniqueFlashMessage(final BaseIncludedModelActiveRecord includedModel) { return new FlashMessage(ERROR, translate(IncludedModelNameIsNotUniqueErrorMessage_StrongMessage, includedModel.getName()), translate(IncludedModelNameIsNotUniqueErrorMessage_RegularMessage), getErrorElementSelector(includedModel)); } @Inject  IncludedModelErrorMessageFactory(final TranslationService translationService); FlashMessage getNameIsNotUniqueFlashMessage(final BaseIncludedModelActiveRecord includedModel); FlashMessage getNameIsBlankFlashMessage(final BaseIncludedModelActiveRecord includedModel);  }