Skip to content

Commit 5298430

Browse files
committed
fixed findAndModifyTest under 2.0.7
1 parent 57efc48 commit 5298430

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/test/com/mongodb/JavaClientTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class JavaClientTest extends TestCase {
3535

3636
public JavaClientTest()
3737
throws IOException , MongoException {
38-
_mongo = new Mongo( "localhost" );
38+
_mongo = new Mongo( "localhost:30000" );
3939
cleanupMongo = _mongo;
4040
cleanupDB = "com_mongodb_unittest_JavaClientTest";
4141
_db = cleanupMongo.getDB( cleanupDB );
@@ -906,10 +906,15 @@ public void testFindAndModify(){
906906

907907
// create new one with upsert and don't return it
908908
dbObj = c.findAndModify( new BasicDBObject( "_id" , 3 ) , null, null, false, new BasicDBObject("$set", new BasicDBObject("b", 7)), false, true);
909-
assertNull(dbObj);
909+
910910
assertEquals( 7 , c.findOne(new BasicDBObject( "_id" , 3 ) ).get( "b" ));
911+
if (serverIsAtLeastVersion(2.1)) {
912+
assertNull(dbObj);
913+
} else {
914+
assertEquals(0, dbObj.keySet().size());
915+
}
911916

912-
// test exception throwing
917+
// test exception throwing
913918
c.insert( new BasicDBObject( "a" , 1 ) );
914919
try {
915920
c.findAndModify( null, null );

0 commit comments

Comments
 (0)