PartitionIterators { public static PartitionIterator descending(ObjectGrid og) { return descending(og, 0); }  static PartitionIterator ascending(ObjectGrid og); static PartitionIterator ascending(ObjectGrid og, int start); static PartitionIterator descending(ObjectGrid og); static PartitionIterator descending(ObjectGrid og, int end); static PartitionIterator range(ObjectGrid og, int start, int end); static int getPartitionSize(ObjectGrid og);  }
@Test public void testDescending() throws Exception { PartitionIterator itr = PartitionIterators.descending(ogclient); int matchingPartiton = 12; while (itr.hasNext()) { Assert.assertEquals("Wrong partition", matchingPartiton--, itr.next()); } Assert.assertEquals("Wrong end", -1, matchingPartiton); itr.reset(); Assert.assertEquals("Reset failed", 12, itr.next()); }
@Test public void testDescendingWithEnd() throws Exception { PartitionIterator itr = PartitionIterators.descending(ogclient, 6); int matchingPartiton = 12; while (itr.hasNext()) { Assert.assertEquals("Wrong partition", matchingPartiton--, itr.next()); } Assert.assertEquals("Wrong end", 5, matchingPartiton); itr.reset(); Assert.assertEquals("Reset failed", 12, itr.next()); }