/** varchar. */
  @Test
  public void getVarchar() {
    ValueSerde serde = ValueSerdeFactory.getVarchar(10);
    HiveVarcharObjectInspector inspector = (HiveVarcharObjectInspector) serde.getInspector();

    StringOption option = new StringOption("hello");
    HiveVarchar value = new HiveVarchar("hello", 10);

    assertThat(inspector.copyObject(option), is((Object) option));
    assertThat(inspector.copyObject(option), is(not(sameInstance((Object) option))));
    assertThat(inspector.copyObject(null), is(nullValue()));
    // Note: HiveVarchar.equals(Object) is not defined, but equals(HiveVarchar) is defined
    assertThat(inspector.getPrimitiveJavaObject(option).equals(value), is(true));
    assertThat(inspector.getPrimitiveJavaObject(null), is(nullValue()));
    assertThat(inspector.getPrimitiveWritableObject(option), is(new HiveVarcharWritable(value)));
    assertThat(inspector.getPrimitiveWritableObject(null), is(nullValue()));

    ValueDriver driver = serde.getDriver(inspector);
    StringOption copy = new StringOption();

    driver.set(copy, option);
    assertThat(copy, is(option));
    driver.set(copy, null);
    assertThat(copy.isNull(), is(true));
  }