|
44 | 44 | import java.util.concurrent.TimeUnit;
|
45 | 45 | import java.util.regex.Pattern;
|
46 | 46 |
|
| 47 | +import static java.util.Arrays.asList; |
47 | 48 | import static org.junit.Assert.assertEquals;
|
48 | 49 | import static org.junit.Assert.assertFalse;
|
49 | 50 | import static org.junit.Assert.assertNotNull;
|
@@ -491,7 +492,7 @@ public void testMapReduceInlineSecondary() throws Exception {
|
491 | 492 | return;
|
492 | 493 | }
|
493 | 494 |
|
494 |
| - Mongo mongo = new MongoClient(Arrays.asList(new ServerAddress("127.0.0.1", 27017), new ServerAddress("127.0.0.1", 27018)), |
| 495 | + Mongo mongo = new MongoClient(asList(new ServerAddress("127.0.0.1", 27017), new ServerAddress("127.0.0.1", 27018)), |
495 | 496 | MongoClientOptions.builder().writeConcern(WriteConcern.UNACKNOWLEDGED).build());
|
496 | 497 |
|
497 | 498 | int size = getReplicaSetSize(mongo);
|
@@ -914,6 +915,24 @@ public void testWriteResultOnUnacknowledgedUpdate(){
|
914 | 915 | assertTrue(res.isLazy());
|
915 | 916 | }
|
916 | 917 |
|
| 918 | + @Test |
| 919 | + public void testWriteResultOnInsert(){ |
| 920 | + WriteResult res = collection.insert(new BasicDBObject()); |
| 921 | + assertEquals(0, res.getN()); |
| 922 | + assertFalse(res.isUpdateOfExisting()); |
| 923 | + assertNull(res.getUpsertedId()); |
| 924 | + assertFalse(res.isLazy()); |
| 925 | + } |
| 926 | + |
| 927 | + @Test |
| 928 | + public void testWriteResultOnInsertList(){ |
| 929 | + WriteResult res = collection.insert(Arrays.<DBObject>asList(new BasicDBObject(), new BasicDBObject())); |
| 930 | + assertEquals(0, res.getN()); |
| 931 | + assertFalse(res.isUpdateOfExisting()); |
| 932 | + assertNull(res.getUpsertedId()); |
| 933 | + assertFalse(res.isLazy()); |
| 934 | + } |
| 935 | + |
917 | 936 | @Test
|
918 | 937 | public void testWriteResultOnUpdate(){
|
919 | 938 | collection.insert(new BasicDBObject("_id", 1));
|
@@ -1101,7 +1120,7 @@ public void testBadKey(){
|
1101 | 1120 | } catch (IllegalArgumentException e) {}
|
1102 | 1121 |
|
1103 | 1122 | try {
|
1104 |
| - final List<BasicDBObject> list = Arrays.asList(new BasicDBObject("$a", 1)); |
| 1123 | + final List<BasicDBObject> list = asList(new BasicDBObject("$a", 1)); |
1105 | 1124 | c.save(new BasicDBObject("a", list));
|
1106 | 1125 | fail("Bad key was accepted");
|
1107 | 1126 | } catch (IllegalArgumentException e) {}
|
|
0 commit comments