List<List<DocumentSnapshot>> batches = Lists.newArrayList();
List<DocumentSnapshot> snapshotList = Lists.newArrayList();
for (int i = 0; i < 3; i++) {
List<DocumentSnapshot> batch = Lists.newArrayList();
for (int j = 0; j < 3; j++) {
DocumentSnapshot snapshot = createMock(DocumentSnapshot.class);
batch.add(snapshot);
snapshotList.add(snapshot);
}
batches.add(batch);
}
expect(repositoryHandler.executeQueryAndAddDocs());
for (List<DocumentSnapshot> batch : batches) {
expectLastCall().andReturn(batch);
}
expectLastCall().andReturn(emptySnapshotList);
replay(repositoryHandler);
for (DocumentSnapshot expected : snapshotList) {
DocumentSnapshot snapshot = repositoryHandlerIterator.next();
assertSame(expected, snapshot);
}
assertFalse(repositoryHandlerIterator.hasNext());
verify(repositoryHandler);
}