use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItemBuilder in project kie-wb-common by kiegroup.
the class DecisionNavigatorTreeViewTest method testTreeItemGetCSSClass.
@Test
public void testTreeItemGetCSSClass() {
final String uuid = "uuid";
final String label = "label";
final DecisionNavigatorItem.Type subItem = CONTEXT;
final Command onClick = () -> {
/* Nothing. */
};
final String expectedCSSClass = "kie-context";
final DecisionNavigatorItem item = new DecisionNavigatorItemBuilder().withUUID(uuid).withLabel(label).withType(subItem).withOnClick(onClick).build();
final String actualCSSClass = treeItem.getCSSClass(item);
assertEquals(expectedCSSClass, actualCSSClass);
}
use of org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItemBuilder in project kie-wb-common by kiegroup.
the class DecisionNavigatorBaseItemFactoryTest method testMakeItem.
@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());
}
Aggregations