@Test public void testMakeOnClickCommand() { final EditExpressionEvent expressionEvent = mock(EditExpressionEvent.class); final CanvasHandler canvasHandler = mock(CanvasHandler.class); final CanvasSelectionEvent event = mock(CanvasSelectionEvent.class); final String uuid = "uuid"; when(dmnGraphUtils.getCanvasHandler()).thenReturn(canvasHandler); doReturn(event).when(factory).makeCanvasSelectionEvent(canvasHandler, uuid); doReturn(expressionEvent).when(factory).makeEditExpressionEvent(node); factory.makeOnClickCommand(node, uuid).execute(); verify(canvasSelectionEvent).fire(event); verify(editExpressionEvent).fire(expressionEvent); }
Command makeOnClickCommand(final Node<View, Edge> node, final String uuid) { return () -> { final CanvasHandler canvas = dmnGraphUtils.getCanvasHandler(); canvasSelectionEvent.fire(makeCanvasSelectionEvent(canvas, uuid)); editExpressionEvent.fire(makeEditExpressionEvent(node)); }; }
DecisionNavigatorNestedItemFactory { Command makeOnClickCommand(final Node<View, Edge> node, final String uuid) { return () -> { final CanvasHandler canvas = dmnGraphUtils.getCanvasHandler(); canvasSelectionEvent.fire(makeCanvasSelectionEvent(canvas, uuid)); editExpressionEvent.fire(makeEditExpressionEvent(node)); }; } }
DecisionNavigatorNestedItemFactory { Command makeOnClickCommand(final Node<View, Edge> node, final String uuid) { return () -> { final CanvasHandler canvas = dmnGraphUtils.getCanvasHandler(); canvasSelectionEvent.fire(makeCanvasSelectionEvent(canvas, uuid)); editExpressionEvent.fire(makeEditExpressionEvent(node)); }; } @Inject  DecisionNavigatorNestedItemFactory(final SessionManager sessionManager,
                                              final Event<EditExpressionEvent> editExpressionEvent,
                                              final DMNGraphUtils dmnGraphUtils,
                                              final @DMNEditor Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                              final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                              final BoxedExpressionHelper helper); }
DecisionNavigatorNestedItemFactory { Command makeOnClickCommand(final Node<View, Edge> node, final String uuid) { return () -> { final CanvasHandler canvas = dmnGraphUtils.getCanvasHandler(); canvasSelectionEvent.fire(makeCanvasSelectionEvent(canvas, uuid)); editExpressionEvent.fire(makeEditExpressionEvent(node)); }; } @Inject  DecisionNavigatorNestedItemFactory(final SessionManager sessionManager,
                                              final Event<EditExpressionEvent> editExpressionEvent,
                                              final DMNGraphUtils dmnGraphUtils,
                                              final @DMNEditor Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                              final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                              final BoxedExpressionHelper helper); DecisionNavigatorItem makeItem(final Node<View, Edge> node); boolean hasNestedElement(final Node<View, Edge> node); }
DecisionNavigatorNestedItemFactory { Command makeOnClickCommand(final Node<View, Edge> node, final String uuid) { return () -> { final CanvasHandler canvas = dmnGraphUtils.getCanvasHandler(); canvasSelectionEvent.fire(makeCanvasSelectionEvent(canvas, uuid)); editExpressionEvent.fire(makeEditExpressionEvent(node)); }; } @Inject  DecisionNavigatorNestedItemFactory(final SessionManager sessionManager,
                                              final Event<EditExpressionEvent> editExpressionEvent,
                                              final DMNGraphUtils dmnGraphUtils,
                                              final @DMNEditor Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                              final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                              final BoxedExpressionHelper helper); DecisionNavigatorItem makeItem(final Node<View, Edge> node); boolean hasNestedElement(final Node<View, Edge> node);  }