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