void () { TestNode main = new TestNode("main"); TestNode dep = new TestNode("dep"); TestNode d = new TestNode("d"); TestNode d2 = new TestNode("d2"); TestNode resMain = new TestNode("resMain"); TestNode resDep = new TestNode("resDep"); TestNode[] allNodes = {main, dep, d, d2, resMain, resDep}; Map<TestNode, TestNode[]> mapIn = new HashMap<>(); mapIn.put(main, new TestNode[]{d, resMain}); mapIn.put(dep, new TestNode[]{main, resDep}); mapIn.put(d, new TestNode[]{d2}); mapIn.put(d2, new TestNode[]{dep, d}); Graph<TestNode> graph = graphByNodes(allNodes, mapIn); DFSTBuilder<TestNode> builder = new DFSTBuilder<>(graph); assertTrue(!builder.isAcyclic()); Comparator<TestNode> comparator = builder.comparator(); assertTrue(comparator.compare(resMain, main) < 0); assertTrue(comparator.compare(resMain, d) < 0); assertTrue(comparator.compare(resMain, d2) < 0); assertTrue(comparator.compare(resDep, dep) < 0); assertTrue(comparator.compare(resMain, resDep) > 0); //reversed loading order }