### Question:
CalendarDateFormatter { public static Date isoStringToDate(String iso) throws IllegalArgumentException { CalendarDate dt = isoStringToCalendarDate(null, iso); return dt.toDate(); } CalendarDateFormatter(String pattern);  CalendarDateFormatter(String pattern, CalendarTimeZone tz, Calendar cal);  CalendarDateFormatter(String pattern, CalendarTimeZone tz); static String toDateTimeStringISO(CalendarDate cd); static String toDateTimeStringISO(Date d); static String toDateTimeStringISO(long millisecs); static String toDateTimeString(CalendarDate cd); static String toDateTimeStringShort(CalendarDate cd); static String toDateTimeString(Date date); static String toDateTimeStringPresent(); static String toDateString(Date date); static String toDateString(CalendarDate cd); static String toDateStringPresent(); static String toTimeUnits(CalendarDate cd); static String toTimeUnits(Date date); static CalendarDateFormatter factory(CalendarPeriod period); @Deprecated static Date parseISODate(String iso); static CalendarDate isoStringToCalendarDate(Calendar calt, String iso); static Date isoStringToDate(String iso); String toString(CalendarDate cd); CalendarDate parse(String timeString); static final String isodatePatternString; }### Answer:
@Test public void shouldBeSameTime() { String isoCET = "2012-04-27T16:00:00+0200"; Date cetDate = CalendarDateFormatter.isoStringToDate(isoCET); String isoMST = "2012-04-27T08:00:00-0600"; Date mstDate = CalendarDateFormatter.isoStringToDate(isoMST); String isoUTC = "2012-04-27T14:00Z"; Date utcDate = CalendarDateFormatter.isoStringToDate(isoUTC); assertEquals(mstDate.getTime(), cetDate.getTime()); assertEquals(mstDate.getTime(), utcDate.getTime()); }
@Test public void shouldHandleOffsetWithoutColon() { String isoCET = "2012-04-27T16:00:00+0200"; Date cetDate = CalendarDateFormatter.isoStringToDate(isoCET); String isoMST = "2012-04-27T08:00:00-0600"; Date mstDate = CalendarDateFormatter.isoStringToDate(isoMST); String isoUTC = "2012-04-27T14:00Z"; Date utcDate = CalendarDateFormatter.isoStringToDate(isoUTC); assertEquals(mstDate.getTime(), cetDate.getTime()); assertEquals(mstDate.getTime(), utcDate.getTime()); }