use of org.bson.BsonBinaryReader in project disq by intelie.
the class DsonToBsonConverterTest method assertConversion.
private void assertConversion(Object input, Map<Object, Object> expected, byte[] control) {
Buffer in = new Buffer();
Buffer out = new Buffer();
DsonSerializer.Instance dson = new DsonSerializer().create();
dson.serialize(in, input);
DsonToBsonConverter converter = new DsonToBsonConverter();
converter.convert(in.read(), out.write());
if (control != null)
assertThat(out.toArray()).isEqualTo(control);
Map decoded = codec.decode(new BsonBinaryReader(ByteBuffer.wrap(out.buf(), 0, out.count())), DecoderContext.builder().build());
assertThat(decoded).isEqualTo(expected);
}
Aggregations