@Test
  public void gsonToBson() throws Exception {
    JsonObject obj = new JsonObject();
    obj.addProperty("boolean", true);
    obj.addProperty("int32", 32);
    obj.addProperty("int64", 64L);
    obj.addProperty("double", 42.42D);
    obj.addProperty("string", "foo");
    obj.add("null", JsonNull.INSTANCE);
    obj.add("array", new JsonArray());
    obj.add("object", new JsonObject());


    BsonDocument doc = Jsons.toBson(obj);
    TypeAdapters.JSON_ELEMENT.write(new BsonWriter(new BsonDocumentWriter(doc)), obj);

    check(doc.keySet()).notEmpty();

    check(doc.get("boolean").getBsonType()).is(BsonType.BOOLEAN);
    check(doc.get("boolean").asBoolean());
    check(doc.get("int32").getBsonType()).is(BsonType.INT32);
    check(doc.get("int32").asInt32().getValue()).is(32);
    check(doc.get("int64").getBsonType()).is(BsonType.INT64);
    check(doc.get("int64").asInt64().getValue()).is(64L);
    check(doc.get("double").getBsonType()).is(BsonType.DOUBLE);
    check(doc.get("double").asDouble().getValue()).is(42.42D);
    check(doc.get("string").getBsonType()).is(BsonType.STRING);
    check(doc.get("string").asString().getValue()).is("foo");
    check(doc.get("null").getBsonType()).is(BsonType.NULL);
    check(doc.get("null").isNull());
    check(doc.get("array").getBsonType()).is(BsonType.ARRAY);
    check(doc.get("array").asArray()).isEmpty();
    check(doc.get("object").getBsonType()).is(BsonType.DOCUMENT);
    check(doc.get("object").asDocument().keySet()).isEmpty();
  }
Tests direct bson and gson mappings
mongo/test/org/immutables/mongo/bson4gson/BsonReaderTest.java