}
}
};
// b) create a traverser
Traverser toTheMiddleTraverser = root.traverse( BREADTH_FIRST,
StopEvaluator.END_OF_GRAPH, returnEvaluator, MyRelTypes.TEST,
Direction.BOTH );
// c) get the first node it returns
startNode = toTheMiddleTraverser.iterator().next();
assertEquals( "2", startNode.getProperty( "node.test.id" ) );
}
catch ( Exception e )
{
e.printStackTrace();
fail( "Something went wrong when trying to get a start node "
+ "in the middle of the tree: " + e );
}
// Construct the real traverser
Traverser traverser = startNode.traverse( BREADTH_FIRST,
StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL,
MyRelTypes.TEST, Direction.OUTGOING );
try
{
this.assertNextNodeId( traverser, "2" );
this.assertNextNodeId( traverser, "5" );
this.assertNextNodeId( traverser, "6" );
this.assertNextNodeId( traverser, "10" );
this.assertNextNodeId( traverser, "11" );
this.assertNextNodeId( traverser, "12" );
this.assertNextNodeId( traverser, "13" );
assertTrue( "Too many nodes returned from traversal", traverser
.iterator().hasNext() == false );
}
catch ( java.util.NoSuchElementException nsee )
{
nsee.printStackTrace();