@Test public void testFireNotificationError() { NotificationContext context = buildNotificationContext(); Command<?, CanvasViolation> source = mock(Command.class); CommandNotification commandNotification = CommandNotification.Builder.build( context, source, Notification.Type.ERROR, "message"); projectMessagesListener.fireNotification(commandNotification); ArgumentCaptor<PublishMessagesEvent> eventCaptor = ArgumentCaptor.forClass(PublishMessagesEvent.class); verify(publishMessagesEvent, times(1)).fire(eventCaptor.capture()); testMessageToPublish(eventCaptor.getValue(), Level.ERROR); }
void fireNotification(final AbstractNotification notification) { final SystemMessage systemMessage = new SystemMessage(); final ArrayList<SystemMessage> messagesList = new ArrayList<>(); switch (notification.getType()) { case ERROR: systemMessage.setLevel(Level.ERROR); break; case WARNING: systemMessage.setLevel(Level.WARNING); break; case INFO: systemMessage.setLevel(Level.INFO); break; } final Path path = getDiagramPath(); systemMessage.setText(notification.getMessage()); systemMessage.setPath(path); systemMessage.setMessageType(getMessageType(path)); messagesList.add(systemMessage); PublishMessagesEvent messages = new PublishMessagesEvent(); messages.setShowSystemConsole(false); messages.setMessagesToPublish(messagesList); publishMessagesEvent.fire(messages); }
ProjectMessagesListener { void fireNotification(final AbstractNotification notification) { final SystemMessage systemMessage = new SystemMessage(); final ArrayList<SystemMessage> messagesList = new ArrayList<>(); switch (notification.getType()) { case ERROR: systemMessage.setLevel(Level.ERROR); break; case WARNING: systemMessage.setLevel(Level.WARNING); break; case INFO: systemMessage.setLevel(Level.INFO); break; } final Path path = getDiagramPath(); systemMessage.setText(notification.getMessage()); systemMessage.setPath(path); systemMessage.setMessageType(getMessageType(path)); messagesList.add(systemMessage); PublishMessagesEvent messages = new PublishMessagesEvent(); messages.setShowSystemConsole(false); messages.setMessagesToPublish(messagesList); publishMessagesEvent.fire(messages); } }
ProjectMessagesListener { void fireNotification(final AbstractNotification notification) { final SystemMessage systemMessage = new SystemMessage(); final ArrayList<SystemMessage> messagesList = new ArrayList<>(); switch (notification.getType()) { case ERROR: systemMessage.setLevel(Level.ERROR); break; case WARNING: systemMessage.setLevel(Level.WARNING); break; case INFO: systemMessage.setLevel(Level.INFO); break; } final Path path = getDiagramPath(); systemMessage.setText(notification.getMessage()); systemMessage.setPath(path); systemMessage.setMessageType(getMessageType(path)); messagesList.add(systemMessage); PublishMessagesEvent messages = new PublishMessagesEvent(); messages.setShowSystemConsole(false); messages.setMessagesToPublish(messagesList); publishMessagesEvent.fire(messages); } protected  ProjectMessagesListener(); @Inject  ProjectMessagesListener(final NotificationsObserver notificationsObserver,
                                   final Event<PublishMessagesEvent> publishMessagesEvent,
                                   final Event<UnpublishMessagesEvent> unpublishMessagesEvent,
                                   final SessionManager clientSessionManager); }
ProjectMessagesListener { void fireNotification(final AbstractNotification notification) { final SystemMessage systemMessage = new SystemMessage(); final ArrayList<SystemMessage> messagesList = new ArrayList<>(); switch (notification.getType()) { case ERROR: systemMessage.setLevel(Level.ERROR); break; case WARNING: systemMessage.setLevel(Level.WARNING); break; case INFO: systemMessage.setLevel(Level.INFO); break; } final Path path = getDiagramPath(); systemMessage.setText(notification.getMessage()); systemMessage.setPath(path); systemMessage.setMessageType(getMessageType(path)); messagesList.add(systemMessage); PublishMessagesEvent messages = new PublishMessagesEvent(); messages.setShowSystemConsole(false); messages.setMessagesToPublish(messagesList); publishMessagesEvent.fire(messages); } protected  ProjectMessagesListener(); @Inject  ProjectMessagesListener(final NotificationsObserver notificationsObserver,
                                   final Event<PublishMessagesEvent> publishMessagesEvent,
                                   final Event<UnpublishMessagesEvent> unpublishMessagesEvent,
                                   final SessionManager clientSessionManager); void enable(); }
ProjectMessagesListener { void fireNotification(final AbstractNotification notification) { final SystemMessage systemMessage = new SystemMessage(); final ArrayList<SystemMessage> messagesList = new ArrayList<>(); switch (notification.getType()) { case ERROR: systemMessage.setLevel(Level.ERROR); break; case WARNING: systemMessage.setLevel(Level.WARNING); break; case INFO: systemMessage.setLevel(Level.INFO); break; } final Path path = getDiagramPath(); systemMessage.setText(notification.getMessage()); systemMessage.setPath(path); systemMessage.setMessageType(getMessageType(path)); messagesList.add(systemMessage); PublishMessagesEvent messages = new PublishMessagesEvent(); messages.setShowSystemConsole(false); messages.setMessagesToPublish(messagesList); publishMessagesEvent.fire(messages); } protected  ProjectMessagesListener(); @Inject  ProjectMessagesListener(final NotificationsObserver notificationsObserver,
                                   final Event<PublishMessagesEvent> publishMessagesEvent,
                                   final Event<UnpublishMessagesEvent> unpublishMessagesEvent,
                                   final SessionManager clientSessionManager); void enable(); static final String MESSAGE_TYPE; }