Serializer<GenericRecord> readerSerializer =
new AvroGenericRecordSerializer(readerSchema);
Serializer<GenericRecord> resolvingSerializer =
new AvroGenericRecordResolvingSerializer(writerSchema, readerSchema);
GenericRecord record = createRecordV1(writerSchema, 1);
writerBytes = writerSerializer.serialize(record);
GenericRecord record1 = writerSerializer.deserialize(writerBytes);
assertEquals(record.get("id"), record1.get("id"));
assertEquals(record.get("age"), record1.get("age"));
assertEquals(record.get("fname"), record1.get("fname"));
assertEquals(record.get("lname"), record1.get("lname"));
GenericRecord record2 = null;
try {
record2 = readerSerializer.deserialize(writerBytes);
} catch(SerializationException e) {}
assertNull(record2);
GenericRecord record3 = resolvingSerializer.deserialize(writerBytes);
assertEquals(record.get("id"), record3.get("id"));
assertEquals(record.get("age"), record3.get("age"));
assertEquals(record.get("fname"), record3.get("fname"));
assertEquals(record.get("lname"), record3.get("lname"));
}