void () { TestNode nA = new TestNode("A"); TestNode nB = new TestNode("B"); TestNode nC = new TestNode("C"); TestNode[] allNodes = {nA, nB, nC}; Map<TestNode, TestNode[]> map = new HashMap<>(); map.put(nA, new TestNode[]{nB}); map.put(nB, new TestNode[]{nA}); map.put(nC, new TestNode[0]); checkCircularDependencyDetected(allNodes, map); }