Test: Fixed DBCursorTest for latest MongoDB version
@@ -30,6 +30,7 @@ import static com.mongodb.ClusterFixture.disableMaxTimeFailPoint;
import static com.mongodb.ClusterFixture.enableMaxTimeFailPoint;
import static com.mongodb.ClusterFixture.isSharded;
import static com.mongodb.ClusterFixture.serverVersionAtLeast;
+import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
@@ -417,7 +418,9 @@ public class DBCursorTest extends DatabaseTestCase {
assertEquals(1, profileCollection.count());
DBObject profileDocument = profileCollection.findOne();
- if (serverVersionAtLeast(3, 2)) {
+ if (serverVersionAtLeast(asList(3, 5, 8))) {
+ assertEquals(expectedComment, ((DBObject) profileDocument.get("command")).get("comment"));
+ } else if (serverVersionAtLeast(3, 2)) {
assertEquals(expectedComment, ((DBObject) profileDocument.get("query")).get("comment"));
} else {
assertEquals(expectedComment, ((DBObject) profileDocument.get("query")).get("$comment"));
