void () { Integer root = 123; JBTreeTraverser<Integer> traverser = new JBTreeTraverser<Integer>(Functions.constant(null)).withRoot(root); JBIterable<Integer> dfs = traverser.traverse(TreeTraversal.PRE_ORDER_DFS); JBIterable<Integer> bfs = traverser.traverse(TreeTraversal.TRACING_BFS); JBIterable<Integer> postDfs = traverser.traverse(TreeTraversal.POST_ORDER_DFS); TreeTraversal.TracingIt<Integer> it1 = dfs.typedIterator(); assertEquals(root, it1.next()); TreeTraversal.TracingIt<Integer> it2 = bfs.typedIterator(); assertEquals(root, it2.next()); TreeTraversal.TracingIt<Integer> it3 = postDfs.typedIterator(); assertEquals(root, it3.next()); assertEquals(Arrays.asList(root), it1.backtrace().toList()); assertEquals(Arrays.asList(root), it2.backtrace().toList()); assertEquals(Arrays.asList(root), it3.backtrace().toList()); assertNull(it1.parent()); assertNull(it2.parent()); assertNull(it3.parent()); }