LogicGraph { @Nullable public Set<LogicNode> successors(@NonNull LogicNode node) { return edge.get(node); } LogicGraph(@NonNull Set<LogicNode> initials, @NonNull Map<String, LogicNode> idToNode, @NonNull Map<LogicNode, Set<LogicNode>> edge); @NonNull static LogicGraph createFromScriptList(@NonNull Collection<ScriptStructure> scripts); @NonNull Set<LogicNode> initialNodes(); @Nullable LogicNode getNode(@NonNull String id); @Nullable Set<LogicNode> successors(@NonNull LogicNode node); @NonNull Set<LogicNode> successorsM(@NonNull LogicNode node);  }
@Test public void testTopology() throws Exception { Set<LogicGraph.LogicNode> nodes = new HashSet<>(); Set<LogicGraph.LogicNode> succs; { succs = graph.successors(node1); nodes.clear(); nodes.add(node2); nodes.add(node3); assertNotNull(succs); assertTrue(succs.containsAll(nodes)); assertTrue(nodes.containsAll(succs)); } { succs = graph.successors(node2); nodes.clear(); nodes.add(node3); assertNotNull(succs); assertTrue(succs.containsAll(nodes)); assertTrue(nodes.containsAll(succs)); } { succs = graph.successors(node3); nodes.clear(); nodes.add(node4); assertNotNull(succs); assertTrue(succs.containsAll(nodes)); assertTrue(nodes.containsAll(succs)); } { succs = graph.successors(node4); assertNull(succs); } }