@Test public void testGraphWithCycle() throws Exception { ListMultimap<String, String> edges = LinkedListMultimap.create(); edges.put("a", "b"); edges.put("b", "d"); edges.put("d", "c"); edges.put("c", "a"); edges.put("d", "e"); edges.put("e", "f"); ImportTraverser<String> traverser = new ImportTraverser<String>(s -> edges.get(s), CacheBuilder.newBuilder().build()); try { List<String> traversal = traverser.traverseGraphRecursively("a"); Assert.fail(); } catch (CircularDependencyException cde) { } try { List<String> traversal = traverser.traverseGraphRecursively("d"); Assert.fail(); } catch (CircularDependencyException cde) { } List<String> traversal = traverser.traverseGraphRecursively("e"); Assert.assertEquals(traversal, Lists.newArrayList("f")); }
List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); }
ImportTraverser { List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); } }
ImportTraverser { List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); }  }
ImportTraverser { List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); }   }
ImportTraverser { List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); }    }