@Test public void testEndCursorAndLimit() { QueryResultList<Entity> results = executeQuery(withLimit(3)); Cursor cursor = results.getCursor(); // points to foo4 results = executeQuery(withEndCursor(cursor).limit(2)); assertEquals(asList(foo1, foo2), results); results = executeQuery(withEndCursor(cursor).limit(5)); // even if limit is past endCursor, endCursor will still apply assertEquals(asList(foo1, foo2, foo3), results); }
@Test public void testEndCursor() { QueryResultList<Entity> results = executeQuery(withLimit(3)); Cursor cursor = results.getCursor(); // points to foo4 results = executeQuery(withEndCursor(cursor)); assertEquals(asList(foo1, foo2, foo3), results); }
@Test public void testEndCursorAndOffsetAndLimit() { QueryResultList<Entity> results = executeQuery(withLimit(3)); Cursor cursor = results.getCursor(); // points to foo4 results = executeQuery(withEndCursor(cursor).offset(1).limit(2)); assertEquals(asList(foo2, foo3), results); results = executeQuery(withEndCursor(cursor).offset(1).limit(5)); assertEquals(asList(foo2, foo3), results); }
@Test public void testEndCursorAndOffset() { QueryResultList<Entity> results = executeQuery(withLimit(3)); Cursor cursor = results.getCursor(); // points to foo4 results = executeQuery(withEndCursor(cursor).offset(1)); assertEquals(asList(foo2, foo3), results); }
@Test public void testEndCursorLessThanOffset() { QueryResultList<Entity> results = executeQuery(withLimit(1)); Cursor cursor = results.getCursor(); // points to foo2 results = executeQuery(withEndCursor(cursor).offset(3)); assertTrue(results.isEmpty()); }