use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNEdge in project kie-wb-common by kiegroup.
the class NodeConnectorTest method testGetSourceNode_WhenThereIsOnlyASingleNode.
@Test
public void testGetSourceNode_WhenThereIsOnlyASingleNode() {
final JSIDMNEdge jsiDMNEdge = mock(JSIDMNEdge.class);
final NodeEntry nodeEntry = mock(NodeEntry.class);
final Node node = mock(Node.class);
final List nodeEntries = singletonList(nodeEntry);
when(nodeEntry.getNode()).thenReturn(node);
Optional<Node> sourceNode = nodeConnector.getSourceNode(jsiDMNEdge, nodeEntries);
assertTrue(sourceNode.isPresent());
assertEquals(sourceNode.get(), node);
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNEdge in project kie-wb-common by kiegroup.
the class NodeConnectorTest method testIsEdgeConnectedWithNode_WhenIsConnectedByTarget.
@Test
public void testIsEdgeConnectedWithNode_WhenIsConnectedByTarget() {
final JSIDMNEdge jsiDMNEdge = mock(JSIDMNEdge.class);
final List nodeEntries = mock(List.class);
final Node sourceNode = mock(Node.class);
doReturn(Optional.of(currentNode)).when(nodeConnector).getTargetNode(jsiDMNEdge, nodeEntries);
doReturn(Optional.of(sourceNode)).when(nodeConnector).getSourceNode(jsiDMNEdge, nodeEntries);
assertTrue(nodeConnector.isEdgeConnectedWithNode(jsiDMNEdge, currentNode, nodeEntries));
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNEdge in project kie-wb-common by kiegroup.
the class NodeConnectorTest method testIsEdgeConnectedWithNode_WhenIsConnectedBySource.
@Test
public void testIsEdgeConnectedWithNode_WhenIsConnectedBySource() {
final JSIDMNEdge jsiDMNEdge = mock(JSIDMNEdge.class);
final List nodeEntries = mock(List.class);
final Node targetNode = mock(Node.class);
doReturn(Optional.of(targetNode)).when(nodeConnector).getTargetNode(jsiDMNEdge, nodeEntries);
doReturn(Optional.of(currentNode)).when(nodeConnector).getSourceNode(jsiDMNEdge, nodeEntries);
assertTrue(nodeConnector.isEdgeConnectedWithNode(jsiDMNEdge, currentNode, nodeEntries));
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNEdge in project kie-wb-common by kiegroup.
the class NodeConnectorTest method testGetSourceNode.
@Test
public void testGetSourceNode() {
final JSIDMNEdge jsiDMNEdge = mock(JSIDMNEdge.class);
final double sourceX = 1.0;
final double sourceY = 2.0;
final JSIPoint sourcePoint = createPoint(sourceX, sourceY);
final JSIPoint targetPoint = createPoint(7, 8);
final List<JSIPoint> waypoints = Arrays.asList(sourcePoint, targetPoint);
final List nodeEntries = mock(List.class);
final Point2D sourcePoint2D = new Point2D(sourceX, sourceY);
when(jsiDMNEdge.getWaypoint()).thenReturn(waypoints);
doReturn(Optional.of(mock(Node.class))).when(nodeConnector).getNodeFromPoint(sourcePoint2D, nodeEntries);
nodeConnector.getSourceNode(jsiDMNEdge, nodeEntries);
verify(nodeConnector).getNodeFromPoint(sourcePoint2D, nodeEntries);
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNEdge in project kie-wb-common by kiegroup.
the class NodeConnectorTest method testIsEdgeConnectedWithNode.
@Test
public void testIsEdgeConnectedWithNode() {
final JSIDMNEdge jsiDMNEdge = mock(JSIDMNEdge.class);
final List nodeEntries = mock(List.class);
final Node targetNode = mock(Node.class);
final Node sourceNode = mock(Node.class);
doReturn(Optional.of(targetNode)).when(nodeConnector).getTargetNode(jsiDMNEdge, nodeEntries);
doReturn(Optional.of(sourceNode)).when(nodeConnector).getSourceNode(jsiDMNEdge, nodeEntries);
assertFalse(nodeConnector.isEdgeConnectedWithNode(jsiDMNEdge, currentNode, nodeEntries));
}
Aggregations