public void testFetchPaginateAsync2Sync2AsyncAndGetAndResetSync2Models() {
QueryAsync<DiscoveryModel> qd = DiscoveryModel.all().async();
Query<PersonLongAutoIDModel> qp = PersonLongAutoIDModel.all();
SienaFuture<List<DiscoveryModel>> futured = qd.paginate(50).fetch();
PersonLongAutoIDModel person = qp.filter("lastName", "Tesla").get();
assertEquals(PERSON_LONGAUTOID_TESLA, person);
List<DiscoveryModel> res = futured.get();
assertEquals(50, res.size());
for(int i=0; i<50; i++){
assertEquals(discs[i], res.get(i));
}
PersonLongAutoIDModel person2 = qp.resetData().filter("lastName", "Curie").get();
assertEquals(PERSON_LONGAUTOID_CURIE, person2);
res = qd.sync().nextPage().fetch();
assertEquals(50, res.size());
for(int i=0; i<50; i++){
assertEquals(discs[i+50], res.get(i));
}
PersonLongAutoIDModel person3 = qp.resetData().filter("lastName", "Einstein").get();
assertEquals(PERSON_LONGAUTOID_EINSTEIN, person3);
futured = qd.nextPage().fetch();
res = futured.get();
assertEquals(50, res.size());