void () { TestNode[] allNodes = new TestNode[10000]; Map<TestNode, TestNode[]> map = new HashMap<>(); for (int i = 0; i < allNodes.length; i++) { allNodes[i] = new TestNode(String.valueOf(i)); if (i != 0) { map.put(allNodes[i], new TestNode[]{allNodes[i - 1]}); } } map.put(allNodes[0], new TestNode[]{allNodes[allNodes.length - 1]}); Graph<TestNode> graph = graphByNodes(allNodes, map); DFSTBuilder<TestNode> builder = new DFSTBuilder<>(graph); assertFalse(builder.isAcyclic()); }