CollapserUtils { public static String getOriginValue(IndexedRecord record) { Schema schema = record.getSchema(); Object origin = record.get(schema.getField(FIELD_ORIGIN).pos()); if (origin instanceof Utf8) { return ((Utf8) record.get(schema.getField(FIELD_ORIGIN).pos())).toString(); } return (String) record.get(schema.getField(FIELD_ORIGIN).pos()); } private  CollapserUtils(); static boolean haveEqualSchema(Collection<IndexedRecord> records); static boolean isEnvelopeSchema(Schema schema); static String getOriginValue(IndexedRecord record); static IndexedRecord getDataRecord(IndexedRecord record); @SuppressWarnings("unchecked") static T getNestedFieldValue(IndexedRecord record, String fieldName); static int getNumberOfFilledFields(IndexedRecord record, List<String> fields); static void sortByFilledDataFields(List<T> records, final List<String> fields); static T merge(T base, T update);  }
@Test public void testGetOriginValue() { assertEquals("origin1", CollapserUtils.getOriginValue(SampleData.envMetadataRecord11)); assertEquals("origin1", CollapserUtils.getOriginValue(SampleData.envTextRecord)); }