@Test public void testCreateSafeDeleteNodeCommand() { final GraphsProvider selectedDiagramProvider = mock(GraphsProvider.class); final Node<?, Edge> node = mock(Node.class); final SafeDeleteNodeCommand.Options options = SafeDeleteNodeCommand.Options.defaults(); final DeleteElementsCommand.DeleteCallback callback = mock(DeleteElementsCommand.DeleteCallback.class); final DMNDeleteElementsGraphCommand command = mock(DMNDeleteElementsGraphCommand.class); when(command.getGraphsProvider()).thenReturn(selectedDiagramProvider); when(node.getUUID()).thenReturn("uuid"); when(command.createSafeDeleteNodeCommand(node, options, callback)).thenCallRealMethod(); final SafeDeleteNodeCommand actual = command.createSafeDeleteNodeCommand(node, options, callback); assertTrue(actual instanceof DMNSafeDeleteNodeCommand); final DMNSafeDeleteNodeCommand dmnCommand = (DMNSafeDeleteNodeCommand) actual; assertEquals(dmnCommand.getNode(), node); assertEquals(dmnCommand.getOptions(), options); assertEquals(dmnCommand.getGraphsProvider(), selectedDiagramProvider); }
@Override protected DMNSafeDeleteNodeCommand createSafeDeleteNodeCommand(final Node<?, Edge> node, final SafeDeleteNodeCommand.Options options, final DeleteCallback callback) { return new DMNSafeDeleteNodeCommand(node, callback.onDeleteNode(node, options), options, getGraphsProvider()); }
DMNDeleteElementsGraphCommand extends DeleteElementsCommand { @Override protected DMNSafeDeleteNodeCommand createSafeDeleteNodeCommand(final Node<?, Edge> node, final SafeDeleteNodeCommand.Options options, final DeleteCallback callback) { return new DMNSafeDeleteNodeCommand(node, callback.onDeleteNode(node, options), options, getGraphsProvider()); } }
DMNDeleteElementsGraphCommand extends DeleteElementsCommand { @Override protected DMNSafeDeleteNodeCommand createSafeDeleteNodeCommand(final Node<?, Edge> node, final SafeDeleteNodeCommand.Options options, final DeleteCallback callback) { return new DMNSafeDeleteNodeCommand(node, callback.onDeleteNode(node, options), options, getGraphsProvider()); } DMNDeleteElementsGraphCommand(final Supplier<Collection<Element>> elements,
                                         final DeleteCallback callback,
                                         final GraphsProvider graphsProvider); }
DMNDeleteElementsGraphCommand extends DeleteElementsCommand { @Override protected DMNSafeDeleteNodeCommand createSafeDeleteNodeCommand(final Node<?, Edge> node, final SafeDeleteNodeCommand.Options options, final DeleteCallback callback) { return new DMNSafeDeleteNodeCommand(node, callback.onDeleteNode(node, options), options, getGraphsProvider()); } DMNDeleteElementsGraphCommand(final Supplier<Collection<Element>> elements,
                                         final DeleteCallback callback,
                                         final GraphsProvider graphsProvider); GraphsProvider getGraphsProvider(); }
DMNDeleteElementsGraphCommand extends DeleteElementsCommand { @Override protected DMNSafeDeleteNodeCommand createSafeDeleteNodeCommand(final Node<?, Edge> node, final SafeDeleteNodeCommand.Options options, final DeleteCallback callback) { return new DMNSafeDeleteNodeCommand(node, callback.onDeleteNode(node, options), options, getGraphsProvider()); } DMNDeleteElementsGraphCommand(final Supplier<Collection<Element>> elements,
                                         final DeleteCallback callback,
                                         final GraphsProvider graphsProvider); GraphsProvider getGraphsProvider();  }