GregorianCalendarTypeConverter implements TypeConverter<String, GregorianCalendar> { @Override public GregorianCalendar convert(String value) { Utils.checkArgument(value != null, "Value to convert must not be null"); Utils.checkArgument(!value.isEmpty(), "Value to convert must not be empty"); Date date = dateTypeConverter.convert(value); GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(date); return gregorianCalendar; } GregorianCalendarTypeConverter();  GregorianCalendarTypeConverter(String dateFormat); @Override GregorianCalendar convert(String value);  }
@Test public void whenInputValueIsLegalValue_ThenShouldReturnValidDate() { String date = "2015-01-01"; GregorianCalendar convertedCalendar = converter.convert(date); assertThat(convertedCalendar).isNotNull(); assertThat(convertedCalendar.getTime()).isNotNull(); assertThat(convertedCalendar.getTime()).isEqualTo(java.sql.Date.valueOf(date)); }