### Question:
DateUtils { public static Date parseDate(final String dateValue) { return parseDate(dateValue, null, null); } private  DateUtils(); static Date parseDate(final String dateValue); static Date parseDate(final MessageHeaders headers, final String headerName); static boolean isAfter(
            final MessageHeaders message1,
            final MessageHeaders message2,
            final String headerName); static boolean isBefore(
            final MessageHeaders message1,
            final MessageHeaders message2,
            final String headerName); static Date parseDate(final String dateValue, final String[] dateFormats); static Date parseDate(
            final String dateValue,
            final String[] dateFormats,
            final Date startDate); static String formatDate(final Date date); static String formatDate(final Date date, final String pattern); static void clearThreadLocal(); static final String PATTERN_RFC1123; static final String PATTERN_RFC1036; static final String PATTERN_ASCTIME; static final TimeZone GMT; }### Answer:
@Test public void testBasicDateParse() throws Exception { final Date date = createDate(2005, Calendar.OCTOBER, 14); final String[] formats = new String[] { DateUtils.PATTERN_RFC1123 }; Assert.assertEquals(date, DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", formats, null)); Assert.assertEquals(date, DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", formats)); Assert.assertEquals(date, DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT")); }
@Test public void testDateParseMessage() throws Exception { final HeaderGroup message1 = new HeaderGroup(); message1.setHeader(new BasicHeader(HttpHeaders.DATE, "Fri, 14 Oct 2005 00:00:00 GMT")); Assert.assertEquals(createDate(2005, Calendar.OCTOBER, 14), DateUtils.parseDate(message1, HttpHeaders.DATE)); final HeaderGroup message2 = new HeaderGroup(); message2.addHeader(new BasicHeader(HttpHeaders.DATE, "Fri, 14 Oct 2005 00:00:00 GMT")); message2.addHeader(new BasicHeader(HttpHeaders.DATE, "Fri, 21 Oct 2005 00:00:00 GMT")); Assert.assertEquals(createDate(2005, Calendar.OCTOBER, 14), DateUtils.parseDate(message2, HttpHeaders.DATE)); }
@Test public void testMalformedDate() { Assert.assertNull(DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", new String[] {}, null)); }
@Test public void testTwoDigitYearDateParse() throws Exception { final String[] formats = new String[] { DateUtils.PATTERN_RFC1036 }; Assert.assertEquals(createDate(2005, Calendar.OCTOBER, 14), DateUtils.parseDate("Friday, 14-Oct-05 00:00:00 GMT", formats, null)); Assert.assertEquals(createDate(1905, Calendar.OCTOBER, 14), DateUtils.parseDate("Friday, 14-Oct-05 00:00:00 GMT", formats, createDate(1900, Calendar.JANUARY, 0))); }
@Test public void testParseQuotedDate() throws Exception { final Date date1 = createDate(2005, Calendar.OCTOBER, 14); final String[] formats = new String[] { DateUtils.PATTERN_RFC1123 }; final Date date2 = DateUtils.parseDate("'Fri, 14 Oct 2005 00:00:00 GMT'", formats); Assert.assertEquals(date1, date2); }