String recordJson =
"{\"type\":\"record\", \"name\":\"Foo\", \"fields\":[{\"name\":\"f\", "
+"\"type\":"+schemaJson+", "
+"\"default\":"+defaultJson+"}]}";
Schema expected = Schema.parse(recordJson);
DatumReader in = new GenericDatumReader(ACTUAL, expected);
GenericData.Record record = (GenericData.Record)
in.read(null, DecoderFactory.defaultFactory().createBinaryDecoder(
new byte[0], null));
assertEquals("Wrong default.", defaultValue, record.get("f"));
assertEquals("Wrong toString", expected, Schema.parse(expected.toString()));
}