@Test
public void convertMap() throws Exception {

    Schema schema = Schema.of(
            Schema.Field.of("a", Schema.Type.BINARY),
            Schema.Field.of("b", Schema.Type.STRING),
            Schema.Field.of("c", Schema.Type.ARRAY),
            Schema.Field.of("d", Schema.Type.LONG),
            Schema.Field.of("e", Schema.Type.DOUBLE));
    Map<String, Object> value = new HashMap<>();
    value.put("a", new byte[] { 0x01, 0x02 });
    value.put("b", "hello");
    value.put("c", Collections.singletonList("hello"));
    value.put("d", 1234);
    value.put("e", 123.456f);
    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.STRING.valueOfSameType(converted.get("b")));
    Assert.assertEquals("hello", converted.get("b"));
    Assert.assertTrue(Schema.Type.ARRAY.valueOfSameType(converted.get("c")));
    Assert.assertEquals(Collections.singletonList("hello"), converted.get("c"));
    Assert.assertTrue(Schema.Type.LONG.valueOfSameType(converted.get("d")));
    Assert.assertEquals(1234L, converted.get("d"));
    Assert.assertTrue(Schema.Type.DOUBLE.valueOfSameType(converted.get("e")));
    Assert.assertEquals(123.456d, (double) converted.get("e"), 0.001);
}