@Test public void testBsonToStringFn() { final Bson bson = BsonDocument.parse(test); assertEquals(test, MongoDbHelper.bsonToString(bson, false)); assertEquals("{\n \"data\": 1\n}", MongoDbHelper.bsonToString(bson, true)); }
public static String bsonToString(Bson bson, boolean indent) { if (bson == null) { return ""; } if (indent) { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jwsIndented); } else { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jws); } }
MongoDbHelper { public static String bsonToString(Bson bson, boolean indent) { if (bson == null) { return ""; } if (indent) { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jwsIndented); } else { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jws); } } }
MongoDbHelper { public static String bsonToString(Bson bson, boolean indent) { if (bson == null) { return ""; } if (indent) { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jwsIndented); } else { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jws); } } private  MongoDbHelper(); }
MongoDbHelper { public static String bsonToString(Bson bson, boolean indent) { if (bson == null) { return ""; } if (indent) { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jwsIndented); } else { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jws); } } private  MongoDbHelper(); static String bsonToString(Bson bson, boolean indent); }
MongoDbHelper { public static String bsonToString(Bson bson, boolean indent) { if (bson == null) { return ""; } if (indent) { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jwsIndented); } else { return bson.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()).toJson(jws); } } private  MongoDbHelper(); static String bsonToString(Bson bson, boolean indent);  }