@Test public void testNewGraphCommand() { final GraphsProvider selectedDiagramProvider = mock(GraphsProvider.class); final Node candidate = mock(Node.class); when(candidate.getUUID()).thenReturn("uuid"); final DMNDeleteNodeCommand cmd = new DMNDeleteNodeCommand(candidate, selectedDiagramProvider); final Command<GraphCommandExecutionContext, RuleViolation> actual = cmd.newGraphCommand(null); assertTrue(actual instanceof DMNSafeDeleteNodeCommand); final DMNSafeDeleteNodeCommand safeCmd = (DMNSafeDeleteNodeCommand) actual; assertEquals(cmd.getCandidate(), safeCmd.getNode()); assertEquals(cmd.getDeleteProcessor(), safeCmd.getSafeDeleteCallback().get()); assertEquals(cmd.getOptions(), safeCmd.getOptions()); assertEquals(cmd.getGraphsProvider(), safeCmd.getGraphsProvider()); }
@Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new DMNSafeDeleteNodeCommand(candidate, deleteProcessor, options, getGraphsProvider()); }
DMNDeleteNodeCommand extends DeleteNodeCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new DMNSafeDeleteNodeCommand(candidate, deleteProcessor, options, getGraphsProvider()); } }
DMNDeleteNodeCommand extends DeleteNodeCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new DMNSafeDeleteNodeCommand(candidate, deleteProcessor, options, getGraphsProvider()); } DMNDeleteNodeCommand(final Node candidate,
                                final GraphsProvider graphsProvider); }
DMNDeleteNodeCommand extends DeleteNodeCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new DMNSafeDeleteNodeCommand(candidate, deleteProcessor, options, getGraphsProvider()); } DMNDeleteNodeCommand(final Node candidate,
                                final GraphsProvider graphsProvider); GraphsProvider getGraphsProvider(); }
DMNDeleteNodeCommand extends DeleteNodeCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new DMNSafeDeleteNodeCommand(candidate, deleteProcessor, options, getGraphsProvider()); } DMNDeleteNodeCommand(final Node candidate,
                                final GraphsProvider graphsProvider); GraphsProvider getGraphsProvider();  }