@Test public void testDisplayableValueForMessageWithTranslation() { List<?> messageArguments = new ArrayList<>(); MarshallingMessage message = new MarshallingMessage.MarshallingMessageBuilder() .messageKey(MESSAGE_KEY) .message(MESSAGE) .messageArguments(messageArguments) .build(); when(translationService.getValue(MESSAGE_KEY, toArray(messageArguments))).thenReturn(MESSAGE_TRANSLATION); assertEquals(MESSAGE_TRANSLATION, popup.displayableValue(message)); }
String displayableValue(MarshallingMessage message) { if (StringUtils.nonEmpty(message.getMessageKey())) { final List<?> arguments = Optional.ofNullable(message.getMessageArguments()).orElse(Collections.emptyList()); String translation = translationService.getValue(message.getMessageKey(), arguments.toArray(new Object[0])); if (!erraiDefaultValue(message.getMessageKey()).equals(translation)) { return translation; } } return message.getMessage(); }
MarshallingResponsePopup { String displayableValue(MarshallingMessage message) { if (StringUtils.nonEmpty(message.getMessageKey())) { final List<?> arguments = Optional.ofNullable(message.getMessageArguments()).orElse(Collections.emptyList()); String translation = translationService.getValue(message.getMessageKey(), arguments.toArray(new Object[0])); if (!erraiDefaultValue(message.getMessageKey()).equals(translation)) { return translation; } } return message.getMessage(); } }
MarshallingResponsePopup { String displayableValue(MarshallingMessage message) { if (StringUtils.nonEmpty(message.getMessageKey())) { final List<?> arguments = Optional.ofNullable(message.getMessageArguments()).orElse(Collections.emptyList()); String translation = translationService.getValue(message.getMessageKey(), arguments.toArray(new Object[0])); if (!erraiDefaultValue(message.getMessageKey()).equals(translation)) { return translation; } } return message.getMessage(); } @Inject  MarshallingResponsePopup(View view, ClientTranslationService translationService); }
MarshallingResponsePopup { String displayableValue(MarshallingMessage message) { if (StringUtils.nonEmpty(message.getMessageKey())) { final List<?> arguments = Optional.ofNullable(message.getMessageArguments()).orElse(Collections.emptyList()); String translation = translationService.getValue(message.getMessageKey(), arguments.toArray(new Object[0])); if (!erraiDefaultValue(message.getMessageKey()).equals(translation)) { return translation; } } return message.getMessage(); } @Inject  MarshallingResponsePopup(View view, ClientTranslationService translationService); void show(String title,
                     String notificationMessage, InlineNotification.InlineNotificationType notificationType,
                     List<MarshallingMessage> messages,
                     String okCommandLabel, Command okCommand); void show(String title,
                     String notificationMessage, InlineNotification.InlineNotificationType notificationType,
                     List<MarshallingMessage> messages,
                     String okCommandLabel); }
MarshallingResponsePopup { String displayableValue(MarshallingMessage message) { if (StringUtils.nonEmpty(message.getMessageKey())) { final List<?> arguments = Optional.ofNullable(message.getMessageArguments()).orElse(Collections.emptyList()); String translation = translationService.getValue(message.getMessageKey(), arguments.toArray(new Object[0])); if (!erraiDefaultValue(message.getMessageKey()).equals(translation)) { return translation; } } return message.getMessage(); } @Inject  MarshallingResponsePopup(View view, ClientTranslationService translationService); void show(String title,
                     String notificationMessage, InlineNotification.InlineNotificationType notificationType,
                     List<MarshallingMessage> messages,
                     String okCommandLabel, Command okCommand); void show(String title,
                     String notificationMessage, InlineNotification.InlineNotificationType notificationType,
                     List<MarshallingMessage> messages,
                     String okCommandLabel);  }