TypeHierarchyBrowser { public void visit(final Class<?> startType, final Mode mode, final Visitor<Class<?>> callback) { this.visit(startType, mode, callback, Integer.MAX_VALUE); }  void visit(final Class<?> startType, final Mode mode, final Visitor<Class<?>> callback); void visit(final Class<?> startType, final Mode mode, final Visitor<Class<?>> callback, final int maxDepth); static TypeHierarchyBrowser INSTANCE; }
@Test public void test() { final List<SimpleEntry<Class<?>, Integer>> actual = new ArrayList<SimpleEntry<Class<?>, Integer>>(); TypeHierarchyBrowser.INSTANCE.visit(this.startClass, this.mode, new Visitor<Class<?>>() { @Override public boolean visited(final Class<?> node, final int distance) { actual.add(new SimpleEntry<Class<?>, Integer>(node, distance)); return TypeHierarchyBrowserTest.this.visitor.visited(node, distance); } }, this.maxDepth); if (this.mode == Mode.ALL) Assert.assertEquals(String.format("Failed to browser %s (%s) to %d", this.startClass, this.mode, this.maxDepth), new HashSet<Map.Entry<Class<?>, Integer>>(this.expectedClasses), new HashSet<Map.Entry<Class<?>, Integer>>(actual)); else Assert.assertEquals(String.format("Failed to browser %s (%s) to %d", this.startClass, this.mode, this.maxDepth), this.expectedClasses, actual); }