void () { TestNode o1 = new TestNode("o1"); TestNode o2 = new TestNode("o2"); TestNode a = new TestNode("a"); TestNode b = new TestNode("b"); TestNode c = new TestNode("c"); for (int oIndex = 0; oIndex < 4; oIndex++) { List<TestNode> list = new ArrayList<>(Arrays.asList(a, b, c)); list.add(oIndex, o1); list.add(oIndex, o2); TestNode[] allNodes = list.toArray(new TestNode[0]); Map<TestNode, TestNode[]> mapIn = new HashMap<>(); mapIn.put(o1, new TestNode[]{a, b, c, o2}); mapIn.put(o2, new TestNode[]{o1}); DFSTBuilder<TestNode> builder = new DFSTBuilder<>(graphByNodes(allNodes, mapIn)); assertFalse(builder.isAcyclic()); Comparator<TestNode> comparator = builder.comparator(); assertTrue("All nodes: " + list, comparator.compare(b, a) < 0); //reversed loading order assertTrue("All nodes: " + list, comparator.compare(c, a) < 0); //reversed loading order assertTrue("All nodes: " + list, comparator.compare(c, b) < 0); //reversed loading order assertTrue("All nodes: " + list, comparator.compare(a, o1) < 0); assertTrue("All nodes: " + list, comparator.compare(a, o2) < 0); assertTrue("All nodes: " + list, comparator.compare(b, o1) < 0); assertTrue("All nodes: " + list, comparator.compare(b, o2) < 0); assertTrue("All nodes: " + list, comparator.compare(c, o1) < 0); assertTrue("All nodes: " + list, comparator.compare(c, o2) < 0); } }