use of com.mongodb.DefaultDBDecoder in project morphia by mongodb.
the class CustomConvertersTest method testFullBSONSerialization.
/**
* This test shows the full serialization, including bson encoding/decoding.
*/
@Test
public void testFullBSONSerialization() {
final MyEntity entity = new MyEntity(1L, new ValueObject(2L));
final DBObject dbObject = getMorphia().toDBObject(entity);
final byte[] data = new DefaultDBEncoder().encode(dbObject);
final DBObject decoded = new DefaultDBDecoder().decode(data, (DBCollection) null);
final MyEntity actual = getMorphia().fromDBObject(getDs(), MyEntity.class, decoded);
assertEquals(entity, actual);
}
Aggregations