@Test
public void valueToString() throws Exception {

  Calendar dateTime = Calendar.getInstance();
  dateTime.clear();
  setTimeZone(dateTime, "GMT-11:30");
  dateTime.set(2012, 1, 29, 13, 0, 0);
  assertEquals("2012-02-29", instance.valueToString(dateTime, null, null, null, null, null));
  Long millis = 1330558323007L;
  millis -= TimeZone.getDefault().getOffset(millis);
  assertEquals("2012-02-29", instance.valueToString(millis, null, null, null, null, null));
  assertEquals("1969-12-31", instance.valueToString(new java.util.Date(-43200000), null, null, null, null, null));
  assertEquals("1969-12-31",
      instance.valueToString(java.sql.Date.valueOf("1969-12-31"), null, null, null, null, null));
  assertEquals("1969-12-31",
      instance.valueToString(LocalDate.parse("1969-12-31"), null, null, null, null, null));
  // TODO support for years beyond 9999
    dateTime.set(Calendar.YEAR, 12344);
    assertEquals("12344-02-29", instance.valueToString(dateTime, null, null, null, null, null));
  expectTypeErrorInValueToString(instance, 0);
}