@Test
public void testFindWithSkipLimitPagination() throws Exception {

    for (int i=0; i < 100; i++) {
        dao.create(TestUser.builder().name("Bob " + String.format("%02d", i)).active(true).build());
    }
    Document query = new Document("active", true);
    Document sort = new Document("name", 1);
    Results<TestUser,Integer> page1 = dao.findWithSkipLimitPagination(dao.getCollection().find(query).sort(sort), 0, 50);
    assertEquals(50, page1.getData().size());
    assertEquals("Bob 00", page1.getData().get(0).getName());
    assertEquals("Bob 49", page1.getData().get(49).getName());
    assertEquals(new Integer(50), page1.getNext().get());
    Results<TestUser,Integer> page2 = dao.findWithSkipLimitPagination(dao.getCollection().find(query).sort(sort), 50, 50);
    assertEquals(50, page2.getData().size());
    assertEquals("Bob 50", page2.getData().get(0).getName());
    assertEquals("Bob 99", page2.getData().get(49).getName());
    assertFalse(page2.getNext().isPresent());
    page2 = dao.findWithSkipLimitPagination(dao.getCollection().find(query).sort(sort), 50, 1000);
    assertEquals(50, page2.getData().size());
    assertEquals("Bob 50", page2.getData().get(0).getName());
    assertEquals("Bob 99", page2.getData().get(49).getName());
    assertFalse(page2.getNext().isPresent());
    Results<TestUser,Integer> nomatch = dao.findWithSkipLimitPagination(dao.getCollection().find(query).sort(sort), 100, 0);
    assertEquals(0, nomatch.getData().size());
    assertFalse(nomatch.getNext().isPresent());
}