Exemple #1
0
  private void assertQuery(MongodbQuery<User> query, User... expected) {
    // System.out.println(query.toString());
    List<User> results = query.list();

    assertNotNull(results);
    if (expected == null) {
      assertEquals("Should get empty result", 0, results.size());
      return;
    }
    assertEquals(expected.length, results.size());
    int i = 0;
    for (User u : expected) {
      assertEquals(u, results.get(i++));
    }
  }
Exemple #2
0
 @Test
 public void UniqueResultAndLimitAndOffset() {
   MongodbQuery<User> q = query().where(user.firstName.startsWith("Ja")).orderBy(user.age.asc());
   assertEquals(4, q.list().size());
   assertEquals(u1, q.list().get(0));
 }