@Test
public void valueOfString() throws Exception {

  Calendar dateTime = Calendar.getInstance();
  dateTime.clear();
  dateTime.set(2012, 1, 29);
  assertEqualCalendar(dateTime,
      instance.valueOfString("2012-02-29", null, null, null, null, null, Calendar.class));
  assertEquals(Long.valueOf(dateTime.getTimeInMillis()),
      instance.valueOfString("2012-02-29", null, null, null, null, null, Long.class));
  assertEquals(dateTime.getTime(),
      instance.valueOfString("2012-02-29", null, null, null, null, null, java.util.Date.class));
  assertEquals(java.sql.Date.valueOf("2012-02-29"),
      instance.valueOfString("2012-02-29", null, null, null, null, null, java.sql.Date.class));
  assertEquals(LocalDate.parse("2012-02-29"),
      instance.valueOfString("2012-02-29", null, null, null, null, null, LocalDate.class));
  // TODO support for years beyond 9999
  // dateTime.set(Calendar.YEAR, 12344);
  // Calendar result = instance.valueOfString("12344-02-29", null, null, null,
  // null, null, Calendar.class);
  // this.assertEqualCalendar(dateTime, result);
  // TODO: Clarify whether negative years are really needed.
  // dateTime.set(-1, 1, 28);
  // assertEquals(dateTime, instance.valueOfString("-0001-02-28", null,
  // Calendar.class));
  expectContentErrorInValueOfString(instance, "2012-02-29T23:32:02");
  expectContentErrorInValueOfString(instance, "2012-02-30");
  expectContentErrorInValueOfString(instance, "20120229");
  expectContentErrorInValueOfString(instance, "2012-02-1");
  expectContentErrorInValueOfString(instance, "2012-2-12");
  expectContentErrorInValueOfString(instance, "123-02-03");
  expectTypeErrorInValueOfString(instance, "2012-02-29");
}