@@ -82,7 +82,25 @@ public void testUserPassAndMultipleHostsWithPort() {
82
82
83
83
@ Test ()
84
84
public void testWriteConcern () {
85
- MongoClientURI uri = new MongoClientURI ("mongodb://localhost/?safe=true" );
85
+ MongoClientURI uri = new MongoClientURI ("mongodb://localhost" );
86
+ assertEquals (WriteConcern .ACKNOWLEDGED , uri .getOptions ().getWriteConcern ());
87
+
88
+ uri = new MongoClientURI ("mongodb://localhost/?wTimeout=5" );
89
+ assertEquals (new WriteConcern (1 , 5 , false , false ), uri .getOptions ().getWriteConcern ());
90
+
91
+ uri = new MongoClientURI ("mongodb://localhost/?fsync=true" );
92
+ assertEquals (new WriteConcern (1 , 0 , true , false ), uri .getOptions ().getWriteConcern ());
93
+
94
+ uri = new MongoClientURI ("mongodb://localhost/?j=true" );
95
+ assertEquals (new WriteConcern (1 , 0 , false , true ), uri .getOptions ().getWriteConcern ());
96
+
97
+ uri = new MongoClientURI ("mongodb://localhost/?w=2&wtimeout=5&fsync=true&j=true" );
98
+ assertEquals (new WriteConcern (2 , 5 , true , true ), uri .getOptions ().getWriteConcern ());
99
+
100
+ uri = new MongoClientURI ("mongodb://localhost/?w=majority&wtimeout=5&fsync=true&j=true" );
101
+ assertEquals (new WriteConcern ("majority" , 5 , true , true ), uri .getOptions ().getWriteConcern ());
102
+
103
+ uri = new MongoClientURI ("mongodb://localhost/?safe=true" );
86
104
assertEquals (WriteConcern .ACKNOWLEDGED , uri .getOptions ().getWriteConcern ());
87
105
88
106
uri = new MongoClientURI ("mongodb://localhost/?safe=false" );
0 commit comments