@Test
public void shouldCorrectlyWriteBinaryValue() {

    byte[] data = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
    @SuppressWarnings( "deprecation" )
    Binary binary = new Binary(Bson.BinaryType.BINARY, data);
    String expected = "{ \"$type\" : 2 , \"$base64\" : \"AAECAwQF\" }";
    String actual = writer.write(binary);
    // print =true;
    assertSame(expected, actual);
}