public static int count(DataIterator it)
  {
    @SuppressWarnings("unused") // used in while loop
    int count = 0;
    for(DataElement element = it.next(); element !=null; element = it.next())
    {
      count++;
    }
    return count;
  }
@Test
  public void testCountByPredicateAtPath() throws Exception
  {
    SimpleTestData data = IteratorTestData.createSimpleTestData();
    
    int count = Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
        .filterBy(Predicates.pathMatchesPathSpec(IteratorTestData.PATH_TO_ID))
        .count();
    
    assertEquals(3, count);
  }