@Test @SuppressWarnings("unchecked") public void validateSuccessNoElementViolations() { final ArgumentCaptor<Consumer> captor = ArgumentCaptor.forClass(Consumer.class); final ArgumentCaptor<CanvasValidationSuccessEvent> captorEvent = ArgumentCaptor.forClass(CanvasValidationSuccessEvent.class); violations = Collections.emptyList(); tested.validate(canvasHandler, callback); verify(diagramValidator).validate(eq(diagram), captor.capture()); captor.getValue().accept(violations); verify(callback).accept(violations); verify(successEvent).fire(captorEvent.capture()); CanvasValidationSuccessEvent event = captorEvent.getValue(); assertEquals(event.getDiagramName(), NAME); assertEquals(event.getDiagramTitle(), TITLE); }
@SuppressWarnings("unchecked") public void validate(final H canvasHandler, final Consumer<Collection<DiagramElementViolation<RuleViolation>>> callback) { diagramValidator.validate(canvasHandler.getDiagram(), violations -> { checkViolations(canvasHandler, violations); callback.accept(violations); }); }
CanvasDiagramValidator { @SuppressWarnings("unchecked") public void validate(final H canvasHandler, final Consumer<Collection<DiagramElementViolation<RuleViolation>>> callback) { diagramValidator.validate(canvasHandler.getDiagram(), violations -> { checkViolations(canvasHandler, violations); callback.accept(violations); }); } }
CanvasDiagramValidator { @SuppressWarnings("unchecked") public void validate(final H canvasHandler, final Consumer<Collection<DiagramElementViolation<RuleViolation>>> callback) { diagramValidator.validate(canvasHandler.getDiagram(), violations -> { checkViolations(canvasHandler, violations); callback.accept(violations); }); } protected  CanvasDiagramValidator(); @Inject  CanvasDiagramValidator(final DiagramValidator<Diagram, RuleViolation> diagramValidator,
                                  final Event<CanvasValidationSuccessEvent> validationSuccessEvent,
                                  final Event<CanvasValidationFailEvent> validationFailEvent); }
CanvasDiagramValidator { @SuppressWarnings("unchecked") public void validate(final H canvasHandler, final Consumer<Collection<DiagramElementViolation<RuleViolation>>> callback) { diagramValidator.validate(canvasHandler.getDiagram(), violations -> { checkViolations(canvasHandler, violations); callback.accept(violations); }); } protected  CanvasDiagramValidator(); @Inject  CanvasDiagramValidator(final DiagramValidator<Diagram, RuleViolation> diagramValidator,
                                  final Event<CanvasValidationSuccessEvent> validationSuccessEvent,
                                  final Event<CanvasValidationFailEvent> validationFailEvent); @SuppressWarnings("unchecked") void validate(final H canvasHandler,
                         final Consumer<Collection<DiagramElementViolation<RuleViolation>>> callback); }
CanvasDiagramValidator { @SuppressWarnings("unchecked") public void validate(final H canvasHandler, final Consumer<Collection<DiagramElementViolation<RuleViolation>>> callback) { diagramValidator.validate(canvasHandler.getDiagram(), violations -> { checkViolations(canvasHandler, violations); callback.accept(violations); }); } protected  CanvasDiagramValidator(); @Inject  CanvasDiagramValidator(final DiagramValidator<Diagram, RuleViolation> diagramValidator,
                                  final Event<CanvasValidationSuccessEvent> validationSuccessEvent,
                                  final Event<CanvasValidationFailEvent> validationFailEvent); @SuppressWarnings("unchecked") void validate(final H canvasHandler,
                         final Consumer<Collection<DiagramElementViolation<RuleViolation>>> callback);  }