}
public void testLimitStatelessIter(){
DiscoveryStringId[] discs = new DiscoveryStringId[150];
for(int i=0; i<150; i++){
discs[i] = new DiscoveryStringId("Disc_"+String.format("%03d", i), StringID_CURIE);
}
pm.insert((Object[])discs);
Query<DiscoveryStringId> query = pm.createQuery(DiscoveryStringId.class).stateless().order("name");
Iterable<DiscoveryStringId> iter = query.limit(50).iter();
Iterator<DiscoveryStringId> it = iter.iterator();
int i=0;
while(it.hasNext()){
DiscoveryStringId disc = it.next();
assertEquals(discs[i++], disc);
}
assertEquals(50, i);
iter = query.limit(50).iter();
it = iter.iterator();
i=0;
while(it.hasNext()){
DiscoveryStringId disc = it.next();
assertEquals(discs[i++], disc);
}
assertEquals(50, i);
iter = query.iter(50);
it = iter.iterator();
i=0;
while(it.hasNext()){
DiscoveryStringId disc = it.next();
assertEquals(discs[i++], disc);
}
assertEquals(50, i);
iter = query.paginate(50).iter();
it = iter.iterator();
i=0;
while(it.hasNext()){
DiscoveryStringId disc = it.next();
assertEquals(discs[i++], disc);
}
assertEquals(50, i);
}