@Test
public void convertMapValueDoesNotHaveOptionalField() throws ParserException {

    Schema schema = Schema.of(
            Schema.Field.of("a", Schema.Type.BINARY),
            Schema.Field.optional("b", Schema.Type.STRING),
            Schema.Field.of("c", Schema.Type.ARRAY));
    Map<String, Object> value = new HashMap<>();
    value.put("a", new byte[] { 0x01, 0x02 });
    value.put("c", Collections.singletonList("hello"));
    Map<String, Object> converted = SchemaValueConverter.convertMap(schema, value);
    Assert.assertEquals(value.size(), converted.size());
    Assert.assertTrue(Schema.Type.BINARY.valueOfSameType(converted.get("a")));
    Assert.assertTrue(Arrays.equals(new byte[] { 0x01, 0x02 }, (byte[]) converted.get("a")));
    Assert.assertTrue(Schema.Type.ARRAY.valueOfSameType(converted.get("c")));
    Assert.assertEquals(Collections.singletonList("hello"), converted.get("c"));
}