Skip to content

Commit 0ad4bd9

Browse files
committed
fixed test for findAndModify
1 parent 496d326 commit 0ad4bd9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test/com/mongodb/JavaClientTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,18 @@ public void testFindAndModify(){
685685
assertNull( c.findOne(new BasicDBObject( "_id" , 1 ) ));
686686

687687
// test exception throwing
688+
c.insert( new BasicDBObject( "a" , 1 ) );
688689
try {
689690
dbObj = c.findAndModify( null, null );
690-
assertTrue(false, "Exception not throw when no update nor remove");
691+
assertTrue(false, "Exception not thrown when no update nor remove");
691692
} catch (MongoException e) {
692693
}
694+
695+
try {
696+
dbObj = c.findAndModify( new BasicDBObject("a", "noexist"), null );
697+
} catch (MongoException e) {
698+
assertTrue(false, "Exception thrown when matching record");
699+
}
693700
}
694701

695702
@Test

0 commit comments

Comments
 (0)