@Test public void testAddToExistingDRD() { final DMNDiagramTuple diagramTuple = mockDmnDiagramTuple(); final Diagram diagram = mock(Diagram.class); final Node graphNode = mock(Node.class); final View graphNodeDefinition = mock(View.class); final DMNDiagram dmnDiagram = spy(new DMNDiagram()); final Collection<Node<? extends Definition<?>, Edge>> selectedNodes = mockNodes(); selectedNodes.add(graphNode); when(diagramTuple.getStunnerDiagram()).thenReturn(diagram); when(diagram.getGraph()).thenReturn(graph); when(graph.nodes()).thenReturn(selectedNodes); when(graphNode.getContent()).thenReturn(graphNodeDefinition); when(graphNodeDefinition.getDefinition()).thenReturn(dmnDiagram); drdContextMenuService.addToExistingDRD(diagramTuple, selectedNodes); verify(graph).addNode(any(Node.class)); verify(selectedEvent, times(1)).fire(any(DMNDiagramSelected.class)); }
public void addToExistingDRD(final DMNDiagramTuple dmnDiagram, final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { selectedNodes.forEach(addNodesToDRD(dmnDiagram.getDMNDiagram(), dmnDiagram.getStunnerDiagram())); selectedEvent.fire(new DMNDiagramSelected(dmnDiagram.getDMNDiagram())); }
DRDContextMenuService { public void addToExistingDRD(final DMNDiagramTuple dmnDiagram, final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { selectedNodes.forEach(addNodesToDRD(dmnDiagram.getDMNDiagram(), dmnDiagram.getStunnerDiagram())); selectedEvent.fire(new DMNDiagramSelected(dmnDiagram.getDMNDiagram())); } }
DRDContextMenuService { public void addToExistingDRD(final DMNDiagramTuple dmnDiagram, final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { selectedNodes.forEach(addNodesToDRD(dmnDiagram.getDMNDiagram(), dmnDiagram.getStunnerDiagram())); selectedEvent.fire(new DMNDiagramSelected(dmnDiagram.getDMNDiagram())); } @Inject  DRDContextMenuService(final DMNDiagramsSession dmnDiagramsSession,
                                 final FactoryManager factoryManager,
                                 final Event<DMNDiagramSelected> selectedEvent,
                                 final DMNDiagramUtils dmnDiagramUtils,
                                 final DMNDeepCloneProcess dmnDeepCloneProcess,
                                 final DMNUnmarshaller dmnUnmarshaller); }
DRDContextMenuService { public void addToExistingDRD(final DMNDiagramTuple dmnDiagram, final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { selectedNodes.forEach(addNodesToDRD(dmnDiagram.getDMNDiagram(), dmnDiagram.getStunnerDiagram())); selectedEvent.fire(new DMNDiagramSelected(dmnDiagram.getDMNDiagram())); } @Inject  DRDContextMenuService(final DMNDiagramsSession dmnDiagramsSession,
                                 final FactoryManager factoryManager,
                                 final Event<DMNDiagramSelected> selectedEvent,
                                 final DMNDiagramUtils dmnDiagramUtils,
                                 final DMNDeepCloneProcess dmnDeepCloneProcess,
                                 final DMNUnmarshaller dmnUnmarshaller); List<DMNDiagramTuple> getDiagrams(); void addToNewDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes); void addToExistingDRD(final DMNDiagramTuple dmnDiagram,
                                 final Collection<Node<? extends Definition<?>, Edge>> selectedNodes); void removeFromCurrentDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes); }
DRDContextMenuService { public void addToExistingDRD(final DMNDiagramTuple dmnDiagram, final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { selectedNodes.forEach(addNodesToDRD(dmnDiagram.getDMNDiagram(), dmnDiagram.getStunnerDiagram())); selectedEvent.fire(new DMNDiagramSelected(dmnDiagram.getDMNDiagram())); } @Inject  DRDContextMenuService(final DMNDiagramsSession dmnDiagramsSession,
                                 final FactoryManager factoryManager,
                                 final Event<DMNDiagramSelected> selectedEvent,
                                 final DMNDiagramUtils dmnDiagramUtils,
                                 final DMNDeepCloneProcess dmnDeepCloneProcess,
                                 final DMNUnmarshaller dmnUnmarshaller); List<DMNDiagramTuple> getDiagrams(); void addToNewDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes); void addToExistingDRD(final DMNDiagramTuple dmnDiagram,
                                 final Collection<Node<? extends Definition<?>, Edge>> selectedNodes); void removeFromCurrentDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes);  }