@Test
public void date_by_timestamp() {
ValueSerde serde = TimestampValueSerdeFactory.DATE;
TimestampObjectInspector inspector = (TimestampObjectInspector) serde.getInspector();
DateOption option = new DateOption(new Date(2014, 7, 1));
Timestamp value = new Timestamp(2014 - 1900, 7 - 1, 1, 0, 0, 0, 0);
assertThat(inspector.copyObject(option), is((Object) option));
assertThat(inspector.copyObject(option), is(not(sameInstance((Object) option))));
assertThat(inspector.copyObject(null), is(nullValue()));
assertThat(inspector.getPrimitiveJavaObject(option), is(value));
assertThat(inspector.getPrimitiveJavaObject(null), is(nullValue()));
assertThat(inspector.getPrimitiveWritableObject(option), is(new TimestampWritable(value)));
assertThat(inspector.getPrimitiveWritableObject(null), is(nullValue()));
ValueDriver driver = serde.getDriver(inspector);
DateOption copy = new DateOption();
driver.set(copy, option);
assertThat(copy, is(option));
driver.set(copy, null);
assertThat(copy.isNull(), is(true));
}