### Question:
Mapper { public String convertDateTime(Date date) { return iso8601DateFormat.format(date); } Mapper(); String convertDateTime(Date date); Date convertDateTime(String isodate);  }### Answer:
@Test @Disabled public void convertDateTimeFromDate() { Mapper mapper = new Mapper(); TimeZone timeZone = new SimpleTimeZone(0, "GMT"); GregorianCalendar calendar = new GregorianCalendar(timeZone); calendar.set(Calendar.YEAR, 2015); calendar.set(Calendar.MONTH, 03); calendar.set(Calendar.DATE, 26); calendar.set(Calendar.HOUR_OF_DAY, 1); calendar.set(Calendar.MINUTE, 37); calendar.set(Calendar.SECOND, 17); Date date = calendar.getTime(); String actualDateTime = mapper.convertDateTime(date); assertEquals(ISO_DATETIME_EXAMPLES[0], actualDateTime); }
@Test @Parameters(method = "getIsoDateTimeExamples") public void testConvertDateTimeFromString(String isoDateTime) throws ParseException { Date date = mapper.convertDateTime(isoDateTime); TimeZone timeZone = new SimpleTimeZone(0, "GMT"); GregorianCalendar calendar = new GregorianCalendar(timeZone); calendar.setTime(date); assertEquals(2015, calendar.get(Calendar.YEAR)); assertEquals(3, calendar.get(Calendar.MONTH)); assertEquals(26, calendar.get(Calendar.DATE)); assertEquals(1, calendar.get(Calendar.HOUR_OF_DAY)); assertEquals(37, calendar.get(Calendar.MINUTE)); assertEquals(17, calendar.get(Calendar.SECOND)); }
@Test @Ignore public void testConvertDateTimeFromDate() { TimeZone timeZone = new SimpleTimeZone(0, "GMT"); GregorianCalendar calendar = new GregorianCalendar(timeZone); calendar.set(Calendar.YEAR, 2015); calendar.set(Calendar.MONTH, 03); calendar.set(Calendar.DATE, 26); calendar.set(Calendar.HOUR_OF_DAY, 1); calendar.set(Calendar.MINUTE, 37); calendar.set(Calendar.SECOND, 17); Date date = calendar.getTime(); String actualDateTime = mapper.convertDateTime(date); assertEquals(ISO_DATETIME_EXAMPLES[0], actualDateTime); }