### Question:
DecisionNavigatorItemFactory { public DecisionNavigatorItem makeRoot(final DMNDiagramTuple diagramTuple) { final DMNDiagramElement dmnDiagramElement = diagramTuple.getDMNDiagram(); final String uuid = dmnDiagramElement.getId().getValue(); final String diagramName = dmnDiagramElement.getName().getValue(); final String label; final boolean isDRG = isDRG(dmnDiagramElement); if (isDRG) { final Graph graph = diagramTuple.getStunnerDiagram().getGraph(); final Node<?, ?> rootNode = getRootNode(graph); label = getNodeName(rootNode); } else { label = diagramName; } return navigatorItemBuilder() .withUUID(uuid) .withLabel(label) .withType(ROOT) .withIsDRG(isDRG) .withOnClick(getOnClickAction(dmnDiagramElement)) .withOnUpdate(getOnUpdate(dmnDiagramElement)) .withOnRemove(getOnRemove(dmnDiagramElement)) .build(); } @Inject  DecisionNavigatorItemFactory(final DecisionNavigatorBaseItemFactory baseItemFactory,
                                        final Event<DMNDiagramSelected> selectedEvent,
                                        final DMNDiagramsSession dmnDiagramsSession); DecisionNavigatorItem makeItem(final Node<View, Edge> node); DecisionNavigatorItem makeRoot(final DMNDiagramTuple diagramTuple); DecisionNavigatorItem makeSeparator(final String label);  }### Answer:
@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()); }
@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()); }