Search in sources :

Example 11 with BsonRegularExpression

use of org.bson.BsonRegularExpression in project mongo-java-driver by mongodb.

the class JsonReaderTest method testRegExp.

@Test
public void testRegExp() {
    String json = "RegExp(\"abc\",\"im\")";
    bsonReader = new JsonReader(json);
    assertEquals(BsonType.REGULAR_EXPRESSION, bsonReader.readBsonType());
    BsonRegularExpression regularExpression = bsonReader.readRegularExpression();
    assertEquals("abc", regularExpression.getPattern());
    assertEquals("im", regularExpression.getOptions());
}
Also used : BsonRegularExpression(org.bson.BsonRegularExpression) Test(org.junit.Test)

Aggregations

BsonRegularExpression (org.bson.BsonRegularExpression)11 Test (org.junit.Test)9 StringWriter (java.io.StringWriter)2 BsonDocument (org.bson.BsonDocument)2 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 Date (java.util.Date)1 List (java.util.List)1 BsonArray (org.bson.BsonArray)1 BsonInt64 (org.bson.BsonInt64)1 BsonString (org.bson.BsonString)1 BsonTimestamp (org.bson.BsonTimestamp)1 Document (org.bson.Document)1 Binary (org.bson.types.Binary)1 Code (org.bson.types.Code)1 CodeWithScope (org.bson.types.CodeWithScope)1 MaxKey (org.bson.types.MaxKey)1 MinKey (org.bson.types.MinKey)1 ObjectId (org.bson.types.ObjectId)1