}
public void testFetchIterLotsOfEntitiesStatefulMixed(){
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).stateful().order("id");
List<Discovery> res = query.fetch(50);
assertEquals(50, res.size());
for(int i=0; i<50; i++){
assertEquals(discs[i], res.get(i));
}
Iterable<Discovery> res2 = query.iter(50);
Iterator<Discovery> it2 = res2.iterator();
int i=50;
while(it2.hasNext()){
Discovery disc = it2.next();
assertEquals(discs[i++], disc);
}
assertEquals(100, i);
res = query.paginate(25).fetch();
assertEquals(25, res.size());
for(i=0; i<25; i++){
assertEquals(discs[i+100], res.get(i));
}
res2 = query.nextPage().iter();
it2 = res2.iterator();
i=125;
while(it2.hasNext()){
Discovery disc = it2.next();
assertEquals(discs[i++], disc);
}
assertEquals(150, i);
res = query.previousPage().fetch();