### Question:
DependencyNodeUtil { public static Iterator<DependencyNode> preorderIterator(DependencyNode dependencyNode) { return new PreorderFirstIterator(dependencyNode); } private  DependencyNodeUtil(); static T selectFirst(Iterator<T> nodeIterator, Predicate<T> filter); static List<T> select(Iterator<T> iterator, Predicate<T> filter); static List<DependencyNode> select(DependencyNode node, Predicate<DependencyNode> filter); static CharSequence prettyPrint(DependencyNode root); static String prettyPrint(DependencyNode root, Predicate<DependencyNode> filter); static Iterator<DependencyNode> depthFirstIterator(DependencyNode dependencyNode); static Iterator<DependencyNode> breadthFirstIterator(DependencyNode dependencyNode); static Iterator<DependencyNode> preorderIterator(DependencyNode dependencyNode); static boolean isForgeAddon(Coordinate coordinate); static final String FORGE_ADDON_CLASSIFIER; }### Answer:
@Test public void testPreorderIterator() { DependencyNodeBuilder root = DependencyNodeBuilder.create(null, DependencyBuilder .create("org.jboss.forge.addon:example1:2.0.0-SNAPSHOT")); DependencyNodeBuilder childOne = DependencyNodeBuilder.create(root, DependencyBuilder.create("org.jboss.forge.addon:example1-child-one:2.0.0-SNAPSHOT")); DependencyNodeBuilder childTwo = DependencyNodeBuilder.create(root, DependencyBuilder.create("org.jboss.forge.addon:example1-child-two:2.0.0-SNAPSHOT")); DependencyNodeBuilder childOneGrandChildOne = DependencyNodeBuilder.create(childOne, DependencyBuilder.create("org.jboss.forge.addon:example1-child-one-grandchild-one:2.0.0-SNAPSHOT")); DependencyNodeBuilder childOneGrandChildTwo = DependencyNodeBuilder.create(childOne, DependencyBuilder.create("org.jboss.forge.addon:example1-child-one-grandchild-two:2.0.0-SNAPSHOT")); childOne.getChildren().add(childOneGrandChildOne); childOne.getChildren().add(childOneGrandChildTwo); root.getChildren().add(childOne); root.getChildren().add(childTwo); Iterator<DependencyNode> iterator = DependencyNodeUtil.preorderIterator(root); Assert.assertTrue("Iterator is empty", iterator.hasNext()); Assert.assertEquals(root, iterator.next()); Assert.assertTrue("Iterator is empty", iterator.hasNext()); Assert.assertEquals(childOne, iterator.next()); Assert.assertTrue("Iterator is empty", iterator.hasNext()); Assert.assertEquals(childOneGrandChildOne, iterator.next()); Assert.assertTrue("Iterator is empty", iterator.hasNext()); Assert.assertEquals(childOneGrandChildTwo, iterator.next()); Assert.assertTrue("Iterator is empty", iterator.hasNext()); Assert.assertEquals(childTwo, iterator.next()); Assert.assertFalse("Iterator is not empty", iterator.hasNext()); }