Exemplo n.º 1
0
 @Test
 public void testLessThan() {
   MockObject o = new MockObject();
   o.i = 5;
   coll.save(o);
   // Ensure that the serializer actually worked
   assertThat((Integer) coll.getDbCollection().findOne().get("i"), equalTo(15));
   assertThat(coll.find().lessThan("i", 12).toArray(), hasSize(1));
 }
Exemplo n.º 2
0
 @Test
 public void testAnd() {
   MockObject o = new MockObject();
   o.i = 5;
   coll.save(o);
   // Ensure that the serializer actually worked
   assertThat(
       coll.find().and(DBQuery.lessThan("i", 12), DBQuery.greaterThan("i", 4)).toArray(),
       hasSize(1));
   assertThat(
       coll.find().and(DBQuery.lessThan("i", 12), DBQuery.greaterThan("i", 9)).toArray(),
       hasSize(0));
 }