use of org.guvnor.messageconsole.events.SystemMessage in project kie-wb-common by kiegroup.
the class ProjectMessagesListenerTest method testFireNotificationError.
@Test
public void testFireNotificationError() {
NotificationContext context = new NotificationContext.Builder().build("test", "test", "test");
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());
final List<SystemMessage> messagesToPublish = eventCaptor.getValue().getMessagesToPublish();
assertEquals(messagesToPublish.size(), 1);
SystemMessage message = messagesToPublish.get(0);
assertEquals(message.getText(), "message");
assertEquals(message.getLevel(), Level.ERROR);
}
Aggregations