use of org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramTuple in project kie-wb-common by kiegroup.
the class DecisionNavigatorItemFactoryTest method testMakeRootWhenDMNDiagramElementIsNotDRG.
@Test
public void testMakeRootWhenDMNDiagramElementIsNotDRG() {
final Diagram stunnerDiagram = mock(Diagram.class);
final Graph graph = mock(Graph.class);
final Node node = mock(Node.class);
final Definition definition = mock(Definition.class);
final String drdName = "DRD 1";
final String dmnDiagramId = "0000";
final DMNDiagramElement dmnDiagramElement = new DMNDiagramElement(new Id(dmnDiagramId), new Name(drdName));
final DMNDiagramTuple diagramTuple = new DMNDiagramTuple(stunnerDiagram, dmnDiagramElement);
when(stunnerDiagram.getGraph()).thenReturn(graph);
when(graph.nodes()).thenReturn(singletonList(node));
when(node.getContent()).thenReturn(definition);
when(definition.getDefinition()).thenReturn(new DMNDiagram());
when(baseItemFactory.getLabel(node)).thenReturn("diagram-name");
final DecisionNavigatorItem decisionNavigatorItem = factory.makeRoot(diagramTuple);
assertEquals(drdName, decisionNavigatorItem.getLabel());
assertEquals(dmnDiagramId, decisionNavigatorItem.getUUID());
assertEquals(ROOT, decisionNavigatorItem.getType());
assertNull(decisionNavigatorItem.getParentUUID());
}
use of org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramTuple in project kie-wb-common by kiegroup.
the class DecisionNavigatorItemFactoryTest method testMakeRootWhenDMNDiagramElementIsDRG.
@Test
public void testMakeRootWhenDMNDiagramElementIsDRG() {
final Diagram stunnerDiagram = mock(Diagram.class);
final Graph graph = mock(Graph.class);
final Node node = mock(Node.class);
final Definition definition = mock(Definition.class);
final String dmnDiagramId = "0000";
final String dmnModelName = "diagram-name";
final DMNDiagramElement dmnDiagramElement = new DMNDiagramElement(new Id(dmnDiagramId), new Name("DRG"));
final DMNDiagramTuple diagramTuple = new DMNDiagramTuple(stunnerDiagram, dmnDiagramElement);
when(stunnerDiagram.getGraph()).thenReturn(graph);
when(graph.nodes()).thenReturn(singletonList(node));
when(node.getContent()).thenReturn(definition);
when(definition.getDefinition()).thenReturn(new DMNDiagram());
when(baseItemFactory.getLabel(node)).thenReturn(dmnModelName);
final DecisionNavigatorItem decisionNavigatorItem = factory.makeRoot(diagramTuple);
assertEquals(dmnModelName, decisionNavigatorItem.getLabel());
assertEquals(dmnDiagramId, decisionNavigatorItem.getUUID());
assertEquals(ROOT, decisionNavigatorItem.getType());
assertNull(decisionNavigatorItem.getParentUUID());
}
Aggregations