DateToCalendarConverter extends AbstractGenericConverter<Date, Calendar> { @Override public Calendar convert(Date source) { Calendar cal = new GregorianCalendar(); cal.setTime(source); return cal; }  @Override Calendar convert(Date source);  }
@Test public void testConvert() throws ParseException { String dateString = "06/27/2017"; DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); Date date; date = df.parse(dateString); Calendar cal = converter.convert(date); assertEquals(date.getTime(), cal.getTime().getTime()); dateString = "01/02/2016"; date = df.parse(dateString); cal = converter.convert(date); assertEquals(date.getTime(), cal.getTime().getTime()); }