use of org.kie.workbench.common.stunner.core.client.canvas.event.command.CanvasCommandExecutedEvent in project kie-wb-common by kiegroup.
the class NotificationsObserverTest method testNotifyCommandSuccess.
@Test
@SuppressWarnings("unchecked")
public void testNotifyCommandSuccess() {
final Command command = mock(Command.class);
final CommandResult<CanvasViolation> result = mock(CommandResult.class);
final CanvasCommandExecutedEvent<? extends CanvasHandler> commandExecutedEvent = new CanvasCommandExecutedEvent<>(canvasHandler, command, result);
commandNotification = new CommandNotification(Notification.Type.INFO, notificationContext, command, "message1");
tested.onGraphCommandExecuted(commandExecutedEvent);
verify(onNotification, times(1)).execute(eq(commandNotification));
verify(commandSuccess, times(1)).execute(eq(commandNotification));
verify(commandFailed, never()).execute(any(CommandNotification.class));
verify(validationSuccess, never()).execute(any(ValidationSuccessNotification.class));
verify(validationFailed, never()).execute(any(ValidationFailedNotification.class));
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.command.CanvasCommandExecutedEvent in project kie-wb-common by kiegroup.
the class UndoSessionCommandTest method testOnCommandExecuted.
@Test
@SuppressWarnings("unchecked")
public void testOnCommandExecuted() {
command.bind(session);
command.listen(statusCallback);
((UndoSessionCommand) command).onCommandExecuted(new CanvasCommandExecutedEvent(null, null, null));
assertFalse(command.isEnabled());
commandHistory.add(mock(Command.class));
((UndoSessionCommand) command).onCommandExecuted(new CanvasCommandExecutedEvent(null, null, null));
assertTrue(command.isEnabled());
verify(statusCallback, times(2)).execute();
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.command.CanvasCommandExecutedEvent in project kie-wb-common by kiegroup.
the class NotificationsObserverTest method testNotifyCommandFailed.
@Test
@SuppressWarnings("unchecked")
public void testNotifyCommandFailed() {
final Command command = mock(Command.class);
final CommandResult<CanvasViolation> result = mock(CommandResult.class);
final CanvasCommandExecutedEvent<? extends CanvasHandler> commandExecutedEvent = new CanvasCommandExecutedEvent<>(canvasHandler, command, result);
commandNotification = new CommandNotification(Notification.Type.ERROR, notificationContext, command, "message1");
tested.onGraphCommandExecuted(commandExecutedEvent);
verify(onNotification, times(1)).execute(eq(commandNotification));
verify(commandFailed, times(1)).execute(eq(commandNotification));
verify(commandSuccess, never()).execute(any(CommandNotification.class));
verify(validationSuccess, never()).execute(any(ValidationSuccessNotification.class));
verify(validationFailed, never()).execute(any(ValidationFailedNotification.class));
}
Aggregations