Graph { public Collection<Node<?>> resolve() { return topologicalSort(); }  Graph addLeaf(Node<?> node); Graph addEdges(Node<?> node, Collection<Node<?>> adjs); Graph addEdge(Node<?> node, Node<?> adj); Collection<Node<?>> resolve();  }
@Test public void testGraphResolution() { final Collection<Node<?>> resolved = seed().resolve(); final ArrayList<Class<?>> classes = new ArrayList<>(resolved.size()); for (Node<?> node : resolved) { classes.add(node.getRefClass()); } assertArrayEquals(new Class<?>[]{BigDecimal.class, Float.class, Long.class, Integer.class}, classes.toArray()); }