}
private static <T> T generateAndParse(Object o, Class<T> cls) throws Exception {
BSONObject bo = new BasicBSONObject();
bo.put("obj", o); //that's why all properties of classes in TC must be named 'obj'
BSONEncoder encoder = new BasicBSONEncoder();
byte[] barr = encoder.encode(bo);
ByteArrayInputStream bais = new ByteArrayInputStream(barr);
ObjectMapper om = new ObjectMapper(new BsonFactory());
om.registerModule(new BsonModule());