コード例 #1
0
 @Test
 public void testLeafs() {
   TreeIterator<TreeNode> it = this.tree.getLeafIterator();
   while (it.hasNext()) {
     TreeNode node = it.next();
     assertThat(node.getChildren(), is(empty()));
   }
 }
コード例 #2
0
 @Test
 public void testTreeTraverse() {
   TreeIterator<TreeNode> it = this.tree.getIterator();
   int index = 0;
   while (it.hasNext()) {
     String nodeName = it.next().toString();
     Assert.assertEquals(nodeName, index == 0 ? "root" : "c" + index);
     index++;
   }
 }