@Test public void testAddToNewDRD() { final Collection<Node<? extends Definition<?>, Edge>> nodes = mock(Collection.class); final Definitions definitions = mock(Definitions.class); final Diagram drgDiagram = mock(Diagram.class); final List<DMNDiagramElement> diagramElements = mock(List.class); when(dmnDiagramsSession.getDRGDiagram()).thenReturn(drgDiagram); when(dmnDiagramUtils.getDefinitions(drgDiagram)).thenReturn(definitions); when(definitions.getDiagramElements()).thenReturn(diagramElements); drdContextMenuService.addToNewDRD(nodes); verify(diagramElements, times(1)).add(any(DMNDiagramElement.class)); verify(dmnDiagramsSession, times(1)).add(any(DMNDiagramElement.class), any(Diagram.class)); verify(selectedEvent, times(1)).fire(any(DMNDiagramSelected.class)); }
public void addToNewDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { final DMNDiagramElement dmnElement = makeDmnDiagramElement(); final Diagram stunnerElement = buildStunnerElement(dmnElement); selectedNodes.forEach(addNodesToDRD(dmnElement, stunnerElement)); addDmnDiagramElementToDRG(dmnElement); dmnDiagramsSession.add(dmnElement, stunnerElement); selectedEvent.fire(new DMNDiagramSelected(dmnElement)); }
DRDContextMenuService { public void addToNewDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { final DMNDiagramElement dmnElement = makeDmnDiagramElement(); final Diagram stunnerElement = buildStunnerElement(dmnElement); selectedNodes.forEach(addNodesToDRD(dmnElement, stunnerElement)); addDmnDiagramElementToDRG(dmnElement); dmnDiagramsSession.add(dmnElement, stunnerElement); selectedEvent.fire(new DMNDiagramSelected(dmnElement)); } }
DRDContextMenuService { public void addToNewDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { final DMNDiagramElement dmnElement = makeDmnDiagramElement(); final Diagram stunnerElement = buildStunnerElement(dmnElement); selectedNodes.forEach(addNodesToDRD(dmnElement, stunnerElement)); addDmnDiagramElementToDRG(dmnElement); dmnDiagramsSession.add(dmnElement, stunnerElement); selectedEvent.fire(new DMNDiagramSelected(dmnElement)); } @Inject  DRDContextMenuService(final DMNDiagramsSession dmnDiagramsSession,
                                 final FactoryManager factoryManager,
                                 final Event<DMNDiagramSelected> selectedEvent,
                                 final DMNDiagramUtils dmnDiagramUtils,
                                 final DMNDeepCloneProcess dmnDeepCloneProcess,
                                 final DMNUnmarshaller dmnUnmarshaller); }
DRDContextMenuService { public void addToNewDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { final DMNDiagramElement dmnElement = makeDmnDiagramElement(); final Diagram stunnerElement = buildStunnerElement(dmnElement); selectedNodes.forEach(addNodesToDRD(dmnElement, stunnerElement)); addDmnDiagramElementToDRG(dmnElement); dmnDiagramsSession.add(dmnElement, stunnerElement); selectedEvent.fire(new DMNDiagramSelected(dmnElement)); } @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 addToNewDRD(final Collection<Node<? extends Definition<?>, Edge>> selectedNodes) { final DMNDiagramElement dmnElement = makeDmnDiagramElement(); final Diagram stunnerElement = buildStunnerElement(dmnElement); selectedNodes.forEach(addNodesToDRD(dmnElement, stunnerElement)); addDmnDiagramElementToDRG(dmnElement); dmnDiagramsSession.add(dmnElement, stunnerElement); selectedEvent.fire(new DMNDiagramSelected(dmnElement)); } @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);  }