### Question:
DataModelUtil { @SuppressWarnings("unchecked") public static <E> DatumReader<E> getDatumReaderForType(Class<E> type, Schema writerSchema) { Schema readerSchema = getReaderSchema(type, writerSchema); GenericData dataModel = getDataModelForType(type); if (dataModel instanceof ReflectData) { return new ReflectDatumReader<E>(writerSchema, readerSchema, (ReflectData)dataModel); } else if (dataModel instanceof SpecificData) { return new SpecificDatumReader<E>(writerSchema, readerSchema, (SpecificData)dataModel); } else { return new GenericDatumReader<E>(writerSchema, readerSchema, dataModel); } }  static GenericData getDataModelForType(Class<E> type); static boolean isGeneric(Class<?> type); @SuppressWarnings("unchecked") static DatumReader<E> getDatumReaderForType(Class<E> type, Schema writerSchema); @SuppressWarnings("unchecked") static Class<E> resolveType(Class<E> type, Schema schema); static Schema getReaderSchema(Class<E> type, Schema schema); static Schema getWriterSchema(Class<E> type, Schema schema); @SuppressWarnings("unchecked") static E createRecord(Class<E> type, Schema schema); static EntityAccessor<E> accessor(Class<E> type, Schema schema);  }### Answer:
@Test public void testGetDatumReaderForGenericType() { Class<GenericData.Record> type = GenericData.Record.class; Schema writerSchema = StandardEvent.getClassSchema(); DatumReader result = DataModelUtil.getDatumReaderForType(type, writerSchema); assertEquals(GenericDatumReader.class, result.getClass()); }
@Test public void testGetDatumReaderForSpecificType() { Class<StandardEvent> type = StandardEvent.class; Schema writerSchema = StandardEvent.getClassSchema(); DatumReader result = DataModelUtil.getDatumReaderForType(type, writerSchema); assertEquals(SpecificDatumReader.class, result.getClass()); }
@Test public void testGetDatumReaderForReflectType() { Class<String> type = String.class; Schema writerSchema = Schema.create(Schema.Type.STRING); DatumReader result = DataModelUtil.getDatumReaderForType(type, writerSchema); assertEquals(ReflectDatumReader.class, result.getClass()); }