@Test public void testSetupEmptyMessage() { final Message message = new Message(); message.setSeverity( Severity.ERROR ); presenter.setup( message ); verify( view ).setup( NotificationType.ERROR, "0" ); }
public void setup(final Message message) { checkNotNull("message", message); final NotificationType notificationType = toNotificationType(message.getSeverity()); if (notificationType.equals(NotificationType.OK)) { view.setupOk(); } else { if (message.getMessages().isEmpty()) { view.setup(notificationType, "0"); } else { final StringBuilder sb = new StringBuilder(); int i = 0; for (final String msg : message.getMessages()) { if (!msg.trim().isEmpty()) { i++; sb.append(i).append(": ").append(msg).append('\n'); } } view.setup(notificationType, String.valueOf(i), clean(sb)); } } }
NotificationPresenter { public void setup(final Message message) { checkNotNull("message", message); final NotificationType notificationType = toNotificationType(message.getSeverity()); if (notificationType.equals(NotificationType.OK)) { view.setupOk(); } else { if (message.getMessages().isEmpty()) { view.setup(notificationType, "0"); } else { final StringBuilder sb = new StringBuilder(); int i = 0; for (final String msg : message.getMessages()) { if (!msg.trim().isEmpty()) { i++; sb.append(i).append(": ").append(msg).append('\n'); } } view.setup(notificationType, String.valueOf(i), clean(sb)); } } } }
NotificationPresenter { public void setup(final Message message) { checkNotNull("message", message); final NotificationType notificationType = toNotificationType(message.getSeverity()); if (notificationType.equals(NotificationType.OK)) { view.setupOk(); } else { if (message.getMessages().isEmpty()) { view.setup(notificationType, "0"); } else { final StringBuilder sb = new StringBuilder(); int i = 0; for (final String msg : message.getMessages()) { if (!msg.trim().isEmpty()) { i++; sb.append(i).append(": ").append(msg).append('\n'); } } view.setup(notificationType, String.valueOf(i), clean(sb)); } } } @Inject  NotificationPresenter(final View view); }
NotificationPresenter { public void setup(final Message message) { checkNotNull("message", message); final NotificationType notificationType = toNotificationType(message.getSeverity()); if (notificationType.equals(NotificationType.OK)) { view.setupOk(); } else { if (message.getMessages().isEmpty()) { view.setup(notificationType, "0"); } else { final StringBuilder sb = new StringBuilder(); int i = 0; for (final String msg : message.getMessages()) { if (!msg.trim().isEmpty()) { i++; sb.append(i).append(": ").append(msg).append('\n'); } } view.setup(notificationType, String.valueOf(i), clean(sb)); } } } @Inject  NotificationPresenter(final View view); View getView(); void setupOk(); void setup(final Message message); }
NotificationPresenter { public void setup(final Message message) { checkNotNull("message", message); final NotificationType notificationType = toNotificationType(message.getSeverity()); if (notificationType.equals(NotificationType.OK)) { view.setupOk(); } else { if (message.getMessages().isEmpty()) { view.setup(notificationType, "0"); } else { final StringBuilder sb = new StringBuilder(); int i = 0; for (final String msg : message.getMessages()) { if (!msg.trim().isEmpty()) { i++; sb.append(i).append(": ").append(msg).append('\n'); } } view.setup(notificationType, String.valueOf(i), clean(sb)); } } } @Inject  NotificationPresenter(final View view); View getView(); void setupOk(); void setup(final Message message);  }