Corc implements Writable { public Object get(String fieldName) throws IOException { Object value = getValueMarshaller(fieldName).getJavaObject(struct); LOG.debug("Fetched {}={}", fieldName, value); return value; } Corc(StructTypeInfo typeInfo, ConverterFactory factory); Object get(String fieldName); Object getWritable(String fieldName); void set(String fieldName, Object value); RecordIdentifier getRecordIdentifier(); void setRecordIdentifier(RecordIdentifier recordIdentifier); OrcStruct getOrcStruct(); SettableStructObjectInspector getInspector(); Object serialize(); @Override void write(DataOutput out); @Override void readFields(DataInput in);  }
@Test public void get() throws IOException, UnexpectedTypeException { when(converter.toJavaObject(new Text(VALUE))).thenReturn(VALUE); SettableStructObjectInspector inspector = corc.getInspector(); OrcStruct struct = corc.getOrcStruct(); StructField structField = inspector.getStructFieldRef("a"); inspector.setStructFieldData(struct, structField, new Text(VALUE)); assertThat(corc.get("a"), is((Object) VALUE)); assertThat(corc.get("a"), is((Object) VALUE)); }
@Test public void getNotExists() throws IOException { StructTypeInfo typeInfo = new StructTypeInfoBuilder().add("a", TypeInfoFactory.stringTypeInfo).build(); Corc corc = new Corc(typeInfo, factory); assertThat(corc.get("b"), is(nullValue())); verify(factory, never()).newConverter(any(ObjectInspector.class)); }