public class TestReflectDatumReader {
@Test
public void testRead_SpecificDataRecord() throws IOException {
FooBarSpecificRecord specificRecord = FooBarSpecificRecord.newBuilder().setId(42)
.setRelatedids(Arrays.asList(1, 2, 3)).build();
byte[] specificRecordBytes = TestSpecificDatumReader.serializeRecord(specificRecord);
Decoder decoder = DecoderFactory.get().binaryDecoder(specificRecordBytes, null);
ReflectDatumReader<FooBarSpecificRecord> reflectDatumReader = new ReflectDatumReader<FooBarSpecificRecord>(
FooBarSpecificRecord.class);
FooBarSpecificRecord deserialized = new FooBarSpecificRecord();
reflectDatumReader.read(deserialized, decoder);
assertEquals(specificRecord, deserialized);
}