use of org.kie.workbench.common.dmn.client.commands.factory.canvas.DMNSafeDeleteNodeCommand in project kie-wb-common by kiegroup.
the class DMNDeleteElementsGraphCommandTest method testCreateSafeDeleteNodeCommand.
@Test
public void testCreateSafeDeleteNodeCommand() {
final DMNGraphsProvider selectedDiagramProvider = mock(DMNGraphsProvider.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);
}
Aggregations