Search in sources :

Example 1 with BsonCodecProvider

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

the class JsonObjectTest method testToBsonDocument.

@Test
public void testToBsonDocument() {
    JsonObject j1 = new JsonObject("{hello: 1}");
    BsonDocument b1 = new BsonDocument("hello", new BsonInt32(1));
    assertEquals(j1.toBsonDocument(null, fromProviders(new JsonObjectCodecProvider(), new BsonCodecProvider())), b1);
}
Also used : BsonCodecProvider(org.bson.codecs.BsonCodecProvider) BsonInt32(org.bson.BsonInt32) BsonDocument(org.bson.BsonDocument) JsonObjectCodecProvider(org.bson.codecs.JsonObjectCodecProvider) Test(org.junit.Test)

Aggregations

BsonDocument (org.bson.BsonDocument)1 BsonInt32 (org.bson.BsonInt32)1 BsonCodecProvider (org.bson.codecs.BsonCodecProvider)1 JsonObjectCodecProvider (org.bson.codecs.JsonObjectCodecProvider)1 Test (org.junit.Test)1