use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class ContentDefinitionIdUtilsTest method createNode.
private Node createNode(final String diagramId) {
final Node node = mock(Node.class);
final Definition definition = mock(Definition.class);
final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class);
when(node.getContent()).thenReturn(definition);
when(hasContentDefinitionId.getDiagramId()).thenReturn(diagramId);
when(definition.getDefinition()).thenReturn(hasContentDefinitionId);
return node;
}
use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class DMNSafeDeleteNodeCommandTest method createMock.
private DMNSafeDeleteNodeCommand createMock(final Object contentDefinition, final Node<Definition<?>, Edge> candidate) {
final DMNSafeDeleteNodeCommand cmd = mock(DMNSafeDeleteNodeCommand.class);
final Definition definition = mock(Definition.class);
when(definition.getDefinition()).thenReturn(contentDefinition);
when(candidate.getContent()).thenReturn(definition);
when(cmd.shouldKeepChildren(candidate)).thenCallRealMethod();
return cmd;
}
use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class DMNSafeDeleteNodeCommandTest method testShouldKeepChildren.
@Test
public void testShouldKeepChildren() {
final DecisionService decisionService = mock(DecisionService.class);
final Node<Definition<?>, Edge> candidate = mock(Node.class);
final DMNSafeDeleteNodeCommand cmd = createMock(decisionService, candidate);
final boolean actual = cmd.shouldKeepChildren(candidate);
assertTrue(actual);
}
use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class DecisionNavigatorItemsProviderTest method mockNode.
private Node mockNode(final Object definition) {
final Node node = mock(Node.class);
final Definition content = mock(Definition.class);
when(node.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(definition);
return node;
}
use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class DMNDiagramsSessionTest method testDefinitionContainsDRGElement_WhenDefinitionIsNotDRGElement.
@Test
public void testDefinitionContainsDRGElement_WhenDefinitionIsNotDRGElement() {
final Node nodeWithContentDefinition = mock(Node.class);
final Definition definition = mock(Definition.class);
final Object obj = mock(Object.class);
when(nodeWithContentDefinition.getContent()).thenReturn(definition);
when(definition.getDefinition()).thenReturn(obj);
assertFalse(dmnDiagramsSession.definitionContainsDRGElement(nodeWithContentDefinition));
}
Aggregations