### Question:
DataModelUtil { public static <E> Schema getReaderSchema(Class<E> type, Schema schema) { Schema readerSchema = schema; GenericData dataModel = getDataModelForType(type); if (dataModel instanceof SpecificData) { readerSchema = ((SpecificData)dataModel).getSchema(type); } return readerSchema; }  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 testGetReaderSchemaForGeneric() { Class<GenericData.Record> type = GenericData.Record.class; Schema writerSchema = StandardEvent.getClassSchema(); Schema expResult = writerSchema; Schema result = DataModelUtil.getReaderSchema(type, writerSchema); assertEquals(expResult, result); }
@Test public void testGetReaderSchemaForSpecific() { Class<StandardEvent> type = StandardEvent.class; Schema writerSchema = StandardEvent.getClassSchema(); Schema expResult = writerSchema; Schema result = DataModelUtil.getReaderSchema(type, writerSchema); assertEquals(expResult, result); }
@Test public void testGetReaderSchemaForReflect() { Class<String> type = String.class; Schema writerSchema = ReflectData.get().getSchema(String.class); Schema expResult = writerSchema; Schema result = DataModelUtil.getReaderSchema(type, writerSchema); assertEquals(expResult, result); }
@Test public void testGetReaderSchemaForCompatibleSpecific() { Class<SmallEvent> type = SmallEvent.class; Schema writerSchema = StandardEvent.getClassSchema(); Schema expResult = SmallEvent.getClassSchema(); Schema result = DataModelUtil.getReaderSchema(type, writerSchema); assertEquals(expResult, result); }
@Test public void testGetReaderSchemaForCompatibleReflect() { Class<ReflectSmallEvent> type = ReflectSmallEvent.class; Schema writerSchema = ReflectData.get().getSchema(ReflectStandardEvent.class); Schema expResult = DataModelUtil.AllowNulls.get().getSchema(ReflectSmallEvent.class); Schema result = DataModelUtil.getReaderSchema(type, writerSchema); assertEquals(expResult, result); }