DependencyGraph { List<InPortNode> inPortNodes() { return inPortNodeList; } DependencyGraph(RuntimeParentModule parentModule, BitSet requestedOutPorts);   }
@Test public void inPortNodes() { List<InPortNode> inPortNodes = diamondGraph.inPortNodes(); Assert.assertEquals(COMPOSITE_MODULE.getInPorts().size(), 2); Assert.assertEquals( inPortNodes.stream().map(InPortNode::getElement).collect(Collectors.toList()), COMPOSITE_MODULE.getInPorts() ); Assert.assertTrue( COMPOSITE_MODULE.getInPorts().stream() .allMatch(inPort -> inPortNodes.get(inPort.getInIndex()) == diamondGraph.sourceNode(inPort)) ); }
@Test public void setHasValue() { DependencyGraph dependencyGraph = new DependencyGraph(COMPOSITE_MODULE, new BitSet()); InPortNode inPortNode = dependencyGraph.inPortNodes().get(0); Assert.assertEquals(inPortNode.getHasValue(), DependencyGraph.HasValue.UNKNOWN); inPortNode.setHasValue(DependencyGraph.HasValue.UNKNOWN); Assert.assertEquals(inPortNode.getHasValue(), DependencyGraph.HasValue.UNKNOWN); inPortNode.setHasValue(DependencyGraph.HasValue.PENDING_VALUE_CHECK); inPortNode.setHasValue(DependencyGraph.HasValue.PENDING_VALUE_CHECK); try { inPortNode.setHasValue(DependencyGraph.HasValue.UNKNOWN); Assert.fail(); } catch (IllegalArgumentException ignore) { } Assert.assertEquals(inPortNode.getHasValue(), DependencyGraph.HasValue.PENDING_VALUE_CHECK); inPortNode.setHasValue(DependencyGraph.HasValue.HAS_VALUE); try { inPortNode.setHasValue(DependencyGraph.HasValue.UNKNOWN); Assert.fail(); } catch (IllegalArgumentException ignore) { } try { inPortNode.setHasValue(DependencyGraph.HasValue.PENDING_VALUE_CHECK); Assert.fail(); } catch (IllegalArgumentException ignore) { } try { inPortNode.setHasValue(DependencyGraph.HasValue.NO_VALUE); Assert.fail(); } catch (IllegalArgumentException ignore) { } }