### Question:
LazyHCatRecord extends HCatRecord { public HCatRecord getWritable() throws HCatException { DefaultHCatRecord d = new DefaultHCatRecord(); d.copy(this); return d; } LazyHCatRecord(Object wrappedObject, ObjectInspector oi); @Override Object get(int fieldNum); @Override List<Object> getAll(); @Override void set(int fieldNum, Object value); @Override int size(); @Override void readFields(DataInput in); @Override void write(DataOutput out); @Override Object get(String fieldName, HCatSchema recordSchema); @Override void set(String fieldName, HCatSchema recordSchema, Object value); @Override void remove(int idx); @Override void copy(HCatRecord r); @Override String toString(); HCatRecord getWritable(); static final Logger LOG; }### Answer:
@Test public void testGetWritable() throws Exception { HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector()).getWritable(); Assert.assertEquals(INT_CONST, ((Integer) r.get(0)).intValue()); Assert.assertEquals(LONG_CONST, ((Long) r.get(1)).longValue()); Assert.assertEquals(DOUBLE_CONST, ((Double) r.get(2)).doubleValue(), 0); Assert.assertEquals(STRING_CONST, (String) r.get(3)); Assert.assertEquals("org.apache.hcatalog.data.DefaultHCatRecord", r.getClass().getName()); }
@Test public void testGetWritable() throws Exception { HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector()).getWritable(); Assert.assertEquals(INT_CONST, ((Integer) r.get(0)).intValue()); Assert.assertEquals(LONG_CONST, ((Long) r.get(1)).longValue()); Assert.assertEquals(DOUBLE_CONST, ((Double) r.get(2)).doubleValue(), 0); Assert.assertEquals(STRING_CONST, (String) r.get(3)); Assert.assertEquals("org.apache.hive.hcatalog.data.DefaultHCatRecord", r.getClass().getName()); }
@Test public void testGetWritable() throws Exception { HCatRecord r = new LazyHCatRecord(getHCatRecord(), getObjectInspector()).getWritable(); Assert.assertEquals(INT_CONST, ((Integer) r.get(0)).intValue()); Assert.assertEquals(LONG_CONST, ((Long) r.get(1)).longValue()); Assert.assertEquals(DOUBLE_CONST, ((Double) r.get(2)).doubleValue(), 0); Assert.assertEquals(STRING_CONST, r.get(3)); Assert.assertEquals("org.apache.hive.hcatalog.data.DefaultHCatRecord", r.getClass().getName()); }