@Test @SuppressWarnings("unchecked") public void testMakeItem() { final String itemUUID = "itemUUID"; final String childUUID = "childUUID"; final String graphUUID = "graphUUID"; final String label = "label"; final Command onClick = mock(Command.class); final Node<Definition, Edge> diagramNode = mock(Node.class); final Definition diagramDefinition = mock(Definition.class); final DMNDiagram diagram = mock(DMNDiagram.class); final DecisionNavigatorItem child = new DecisionNavigatorItemBuilder().withUUID(childUUID).build(); final List<DecisionNavigatorItem> nestedItems = singletonList(child); when(node.getUUID()).thenReturn(itemUUID); doReturn(label).when(factory).getLabel(node); doReturn(onClick).when(factory).makeOnClickCommand(node); doReturn(nestedItems).when(factory).makeNestedItems(node); when(graph.nodes()).thenReturn(Collections.singletonList(diagramNode)); when(diagramNode.getContent()).thenReturn(diagramDefinition); when(diagramDefinition.getDefinition()).thenReturn(diagram); when(diagramNode.getUUID()).thenReturn(graphUUID); final DecisionNavigatorItem item = factory.makeItem(node, ITEM); assertEquals(itemUUID, item.getUUID()); assertEquals(label, item.getLabel()); assertTrue(item.getOnClick().isPresent()); assertEquals(onClick, item.getOnClick().get()); assertEquals(asTreeSet(child), item.getChildren()); assertEquals(itemUUID, child.getParentUUID()); }
public DecisionNavigatorItem makeItem(final Node<View, Edge> node, final DecisionNavigatorItem.Type type) { final String uuid = node.getUUID(); final String label = getLabel(node); final Command onClick = makeOnClickCommand(node); final List<DecisionNavigatorItem> nestedItems = makeNestedItems(node); final DecisionNavigatorItem item = navigatorItemBuilder() .withUUID(uuid) .withLabel(label) .withType(type) .withOnClick(onClick) .build(); nestedItems.forEach(item::addChild); return item; }
DecisionNavigatorBaseItemFactory { public DecisionNavigatorItem makeItem(final Node<View, Edge> node, final DecisionNavigatorItem.Type type) { final String uuid = node.getUUID(); final String label = getLabel(node); final Command onClick = makeOnClickCommand(node); final List<DecisionNavigatorItem> nestedItems = makeNestedItems(node); final DecisionNavigatorItem item = navigatorItemBuilder() .withUUID(uuid) .withLabel(label) .withType(type) .withOnClick(onClick) .build(); nestedItems.forEach(item::addChild); return item; } }
DecisionNavigatorBaseItemFactory { public DecisionNavigatorItem makeItem(final Node<View, Edge> node, final DecisionNavigatorItem.Type type) { final String uuid = node.getUUID(); final String label = getLabel(node); final Command onClick = makeOnClickCommand(node); final List<DecisionNavigatorItem> nestedItems = makeNestedItems(node); final DecisionNavigatorItem item = navigatorItemBuilder() .withUUID(uuid) .withLabel(label) .withType(type) .withOnClick(onClick) .build(); nestedItems.forEach(item::addChild); return item; } @Inject  DecisionNavigatorBaseItemFactory(final DecisionNavigatorNestedItemFactory nestedItemFactory,
                                            final TextPropertyProviderFactory textPropertyProviderFactory,
                                            final CanvasFocusUtils canvasFocusUtils,
                                            final DefinitionUtils definitionUtils,
                                            final TranslationService translationService,
                                            final DMNDiagramsSession dmnDiagramsSession,
                                            final LazyCanvasFocusUtils lazyCanvasFocusUtils,
                                            final Event<DMNDiagramSelected> selectedEvent); }
DecisionNavigatorBaseItemFactory { public DecisionNavigatorItem makeItem(final Node<View, Edge> node, final DecisionNavigatorItem.Type type) { final String uuid = node.getUUID(); final String label = getLabel(node); final Command onClick = makeOnClickCommand(node); final List<DecisionNavigatorItem> nestedItems = makeNestedItems(node); final DecisionNavigatorItem item = navigatorItemBuilder() .withUUID(uuid) .withLabel(label) .withType(type) .withOnClick(onClick) .build(); nestedItems.forEach(item::addChild); return item; } @Inject  DecisionNavigatorBaseItemFactory(final DecisionNavigatorNestedItemFactory nestedItemFactory,
                                            final TextPropertyProviderFactory textPropertyProviderFactory,
                                            final CanvasFocusUtils canvasFocusUtils,
                                            final DefinitionUtils definitionUtils,
                                            final TranslationService translationService,
                                            final DMNDiagramsSession dmnDiagramsSession,
                                            final LazyCanvasFocusUtils lazyCanvasFocusUtils,
                                            final Event<DMNDiagramSelected> selectedEvent); DecisionNavigatorItem makeItem(final Node<View, Edge> node,
                                          final DecisionNavigatorItem.Type type); }
DecisionNavigatorBaseItemFactory { public DecisionNavigatorItem makeItem(final Node<View, Edge> node, final DecisionNavigatorItem.Type type) { final String uuid = node.getUUID(); final String label = getLabel(node); final Command onClick = makeOnClickCommand(node); final List<DecisionNavigatorItem> nestedItems = makeNestedItems(node); final DecisionNavigatorItem item = navigatorItemBuilder() .withUUID(uuid) .withLabel(label) .withType(type) .withOnClick(onClick) .build(); nestedItems.forEach(item::addChild); return item; } @Inject  DecisionNavigatorBaseItemFactory(final DecisionNavigatorNestedItemFactory nestedItemFactory,
                                            final TextPropertyProviderFactory textPropertyProviderFactory,
                                            final CanvasFocusUtils canvasFocusUtils,
                                            final DefinitionUtils definitionUtils,
                                            final TranslationService translationService,
                                            final DMNDiagramsSession dmnDiagramsSession,
                                            final LazyCanvasFocusUtils lazyCanvasFocusUtils,
                                            final Event<DMNDiagramSelected> selectedEvent); DecisionNavigatorItem makeItem(final Node<View, Edge> node,
                                          final DecisionNavigatorItem.Type type);  }