@Test public void testRun() { final Graph graph = mock(Graph.class); final Node node = mock(Node.class); this.tested = spy(new SafeDeleteNodeProcessor(new ChildrenTraverseProcessorImpl(new TreeWalkTraverseProcessorImpl()), graph, node)); final ArrayDeque nodes = mock(ArrayDeque.class); doReturn(nodes).when(tested).createNodesDequeue(); doNothing().when(tested).deleteChildren(callback, nodes); doNothing().when(tested).processNode(node, callback, true); tested.run(callback); verify(tested).deleteChildren(callback, nodes); verify(tested, never()).deleteGlobalGraphNodes(callback, nodes); }
@SuppressWarnings("unchecked") public void run(final Callback callback) { final Deque<Node<View, Edge>> nodes = createNodesDequeue(); processedConnectors.clear(); if (!keepChildren) { deleteChildren(callback, nodes); } processNode(candidate, callback, true); graphsProvider.ifPresent(selectedDiagram -> { if (selectedDiagram.isGlobalGraphSelected()) { deleteGlobalGraphNodes(callback, nodes); } }); }
SafeDeleteNodeProcessor { @SuppressWarnings("unchecked") public void run(final Callback callback) { final Deque<Node<View, Edge>> nodes = createNodesDequeue(); processedConnectors.clear(); if (!keepChildren) { deleteChildren(callback, nodes); } processNode(candidate, callback, true); graphsProvider.ifPresent(selectedDiagram -> { if (selectedDiagram.isGlobalGraphSelected()) { deleteGlobalGraphNodes(callback, nodes); } }); } }
SafeDeleteNodeProcessor { @SuppressWarnings("unchecked") public void run(final Callback callback) { final Deque<Node<View, Edge>> nodes = createNodesDequeue(); processedConnectors.clear(); if (!keepChildren) { deleteChildren(callback, nodes); } processNode(candidate, callback, true); graphsProvider.ifPresent(selectedDiagram -> { if (selectedDiagram.isGlobalGraphSelected()) { deleteGlobalGraphNodes(callback, nodes); } }); } SafeDeleteNodeProcessor(final ChildrenTraverseProcessor childrenTraverseProcessor,
                                   final Graph graph,
                                   final Node<Definition<?>, Edge> candidate);  SafeDeleteNodeProcessor(final ChildrenTraverseProcessor childrenTraverseProcessor,
                                   final Graph graph,
                                   final Node<Definition<?>, Edge> candidate,
                                   final boolean keepChildren,
                                   final TreeWalkTraverseProcessor treeWalkTraverseProcessor,
                                   final GraphsProvider graphsProvider); }
SafeDeleteNodeProcessor { @SuppressWarnings("unchecked") public void run(final Callback callback) { final Deque<Node<View, Edge>> nodes = createNodesDequeue(); processedConnectors.clear(); if (!keepChildren) { deleteChildren(callback, nodes); } processNode(candidate, callback, true); graphsProvider.ifPresent(selectedDiagram -> { if (selectedDiagram.isGlobalGraphSelected()) { deleteGlobalGraphNodes(callback, nodes); } }); } SafeDeleteNodeProcessor(final ChildrenTraverseProcessor childrenTraverseProcessor,
                                   final Graph graph,
                                   final Node<Definition<?>, Edge> candidate);  SafeDeleteNodeProcessor(final ChildrenTraverseProcessor childrenTraverseProcessor,
                                   final Graph graph,
                                   final Node<Definition<?>, Edge> candidate,
                                   final boolean keepChildren,
                                   final TreeWalkTraverseProcessor treeWalkTraverseProcessor,
                                   final GraphsProvider graphsProvider); @SuppressWarnings("unchecked") void run(final Callback callback); String getCandidateDiagramId(); String getCandidateContentDefinitionId(); }
SafeDeleteNodeProcessor { @SuppressWarnings("unchecked") public void run(final Callback callback) { final Deque<Node<View, Edge>> nodes = createNodesDequeue(); processedConnectors.clear(); if (!keepChildren) { deleteChildren(callback, nodes); } processNode(candidate, callback, true); graphsProvider.ifPresent(selectedDiagram -> { if (selectedDiagram.isGlobalGraphSelected()) { deleteGlobalGraphNodes(callback, nodes); } }); } SafeDeleteNodeProcessor(final ChildrenTraverseProcessor childrenTraverseProcessor,
                                   final Graph graph,
                                   final Node<Definition<?>, Edge> candidate);  SafeDeleteNodeProcessor(final ChildrenTraverseProcessor childrenTraverseProcessor,
                                   final Graph graph,
                                   final Node<Definition<?>, Edge> candidate,
                                   final boolean keepChildren,
                                   final TreeWalkTraverseProcessor treeWalkTraverseProcessor,
                                   final GraphsProvider graphsProvider); @SuppressWarnings("unchecked") void run(final Callback callback); String getCandidateDiagramId(); String getCandidateContentDefinitionId();  }