Search in sources :

Example 1 with CanvasValidationFailEvent

use of org.kie.workbench.common.stunner.core.client.validation.canvas.CanvasValidationFailEvent in project kie-wb-common by kiegroup.

the class NotificationsObserverTest method testNotifyValidationFailed.

@Test
@SuppressWarnings("unchecked")
public void testNotifyValidationFailed() {
    final DiagramElementViolation violation = mock(DiagramElementViolation.class);
    final Collection<DiagramElementViolation<RuleViolation>> violations = Collections.singletonList(violation);
    validationFailedNotification = new ValidationFailedNotification(violations, notificationContext, "message1", Notification.Type.ERROR);
    final CanvasValidationFailEvent validationFailEvent = new CanvasValidationFailEvent(UUID, NAME, TITLE, violations);
    tested.onCanvasValidationFailEvent(validationFailEvent);
    verify(onNotification, times(1)).execute(any(Notification.class));
    verify(validationFailed, times(1)).execute(eq(validationFailedNotification));
    verify(commandFailed, never()).execute(any(CommandNotification.class));
    verify(validationSuccess, never()).execute(any(ValidationSuccessNotification.class));
    verify(commandSuccess, never()).execute(any(CommandNotification.class));
}
Also used : DiagramElementViolation(org.kie.workbench.common.stunner.core.validation.DiagramElementViolation) CanvasValidationFailEvent(org.kie.workbench.common.stunner.core.client.validation.canvas.CanvasValidationFailEvent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CanvasValidationFailEvent (org.kie.workbench.common.stunner.core.client.validation.canvas.CanvasValidationFailEvent)1 DiagramElementViolation (org.kie.workbench.common.stunner.core.validation.DiagramElementViolation)1