Corc implements Writable { public void set(String fieldName, Object value) throws IOException { getValueMarshaller(fieldName).setWritableObject(struct, value); LOG.debug("Set {}={}", fieldName, 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 set() throws UnexpectedTypeException, IOException { when(converter.toWritableObject(VALUE)).thenReturn(new Text(VALUE)); corc.set("a", VALUE); SettableStructObjectInspector inspector = corc.getInspector(); OrcStruct struct = corc.getOrcStruct(); StructField structField = inspector.getStructFieldRef("a"); Object data = inspector.getStructFieldData(struct, structField); assertThat(data, is((Object) new Text(VALUE))); }
@Test public void setNotExists() throws IOException { corc.set("b", VALUE); verify(factory, never()).newConverter(any(ObjectInspector.class)); }