Пример #1
0
 @Test
 public void testOrNegative() throws Exception {
   insertMockObject();
   DBCursor<MockObject> cursor =
       coll.find().or(DBQuery.is("integer", 9), DBQuery.lessThan("integer", 9));
   assertThat(cursor.hasNext(), equalTo(false));
 }
Пример #2
0
 @Test
 public void testNorNegative() throws Exception {
   insertMockObject();
   DBCursor<MockObject> cursor =
       coll.find()
           .and(
               DBQuery.lessThan("integer", 9),
               DBQuery.is("string", "hello"),
               DBQuery.greaterThan("integer", 11));
   assertThat(cursor.hasNext(), equalTo(false));
 }
Пример #3
0
 @Test
 public void testOrPositive() throws Exception {
   MockObject mockObject = insertMockObject();
   DBCursor<MockObject> cursor =
       coll.find()
           .or(
               DBQuery.is("integer", 9),
               DBQuery.greaterThan("integer", 9),
               DBQuery.lessThan("integer", 9));
   assertThat(cursor.hasNext(), equalTo(true));
   assertThat(cursor.next(), equalTo(mockObject));
 }
Пример #4
0
 @Test
 public void testSimpleEquals() {
   coll.save(new MockObject());
   String id = coll.findOne().id;
   assertNotNull(coll.findOne(DBQuery.is("_id", id)));
 }