### Question:
PreOrderTreeTraversalDriver { public <E, N extends OpenNode<E, N>> void traverseTree(Tree<E, N> tree, TreeWalker<N> walker) { walker.onStarted(); if (tree.isEmpty()) { walker.onCompleted(); } else { final N node = tree.getRoot(); accept(node, walker); walker.onCompleted(); } }  void traverseTree(Tree<E, N> tree, TreeWalker<N> walker);  }### Answer:
@Test public void empty() { driver.traverseTree(emptyTree, walker); inOrder.verify(walker).onStarted(); inOrder.verify(walker).onCompleted(); inOrder.verifyNoMoreInteractions(); }
@Test public void nodes() { driver.traverseTree(tree, walker); inOrder.verify(walker).onStarted(); inOrder.verify(walker).onNode(linkedTreeElementMatcher("f")); inOrder.verify(walker).onNodeChildrenStarted(linkedTreeElementMatcher("f")); inOrder.verify(walker).onNode(linkedTreeElementMatcher("b")); inOrder.verify(walker).onNodeChildrenStarted(linkedTreeElementMatcher("b")); inOrder.verify(walker).onNode(linkedTreeElementMatcher("a")); inOrder.verify(walker).onNodeNoChildren(linkedTreeElementMatcher("a")); inOrder.verify(walker).onNodeChildrenRemaining(linkedTreeElementMatcher("b")); inOrder.verify(walker).onNode(linkedTreeElementMatcher("d")); inOrder.verify(walker).onNodeChildrenStarted(linkedTreeElementMatcher("d")); inOrder.verify(walker).onNode(linkedTreeElementMatcher("c")); inOrder.verify(walker).onNodeNoChildren(linkedTreeElementMatcher("c")); inOrder.verify(walker).onNodeChildrenRemaining(linkedTreeElementMatcher("d")); inOrder.verify(walker).onNode(linkedTreeElementMatcher("e")); inOrder.verify(walker).onNodeNoChildren(linkedTreeElementMatcher("e")); inOrder.verify(walker).onNodeChildrenCompleted(linkedTreeElementMatcher("d")); inOrder.verify(walker).onNodeChildrenCompleted(linkedTreeElementMatcher("b")); inOrder.verify(walker).onNodeChildrenRemaining(linkedTreeElementMatcher("f")); inOrder.verify(walker).onNode(linkedTreeElementMatcher("i")); inOrder.verify(walker).onNodeChildrenStarted(linkedTreeElementMatcher("i")); inOrder.verify(walker).onNode(linkedTreeElementMatcher("h")); inOrder.verify(walker).onNodeChildrenStarted(linkedTreeElementMatcher("h")); inOrder.verify(walker).onNode(linkedTreeElementMatcher("g")); inOrder.verify(walker).onNodeNoChildren(linkedTreeElementMatcher("g")); inOrder.verify(walker).onNodeChildrenCompleted(linkedTreeElementMatcher("h")); inOrder.verify(walker).onNodeChildrenCompleted(linkedTreeElementMatcher("i")); inOrder.verify(walker).onNodeChildrenCompleted(linkedTreeElementMatcher("f")); inOrder.verify(walker).onCompleted(); inOrder.verifyNoMoreInteractions(); verifyNoMoreInteractions(walker); }