### Question:
HttpHeaderDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { Date date = super.parse(text, pos); if (date == null) { date = format1.parse(text, pos); } if (date == null) { date = format2.parse(text, pos); } return date; } private  HttpHeaderDateFormat(); @Override Date parse(String text, ParsePosition pos);  }### Answer:
@Test public void testParse() throws ParseException { HttpHeaderDateFormat format = HttpHeaderDateFormat.get(); final Date parsedDateWithSingleDigitDay = format.parse("Sun, 6 Nov 1994 08:49:37 GMT"); Assert.assertNotNull(parsedDateWithSingleDigitDay); Assert.assertEquals(DATE, parsedDateWithSingleDigitDay); final Date parsedDateWithDoubleDigitDay = format.parse("Sun, 06 Nov 1994 08:49:37 GMT"); Assert.assertNotNull(parsedDateWithDoubleDigitDay); Assert.assertEquals(DATE, parsedDateWithDoubleDigitDay); final Date parsedDateWithDashSeparatorSingleDigitDay = format.parse("Sunday, 06-Nov-94 08:49:37 GMT"); Assert.assertNotNull(parsedDateWithDashSeparatorSingleDigitDay); Assert.assertEquals(DATE, parsedDateWithDashSeparatorSingleDigitDay); final Date parsedDateWithSingleDoubleDigitDay = format.parse("Sunday, 6-Nov-94 08:49:37 GMT"); Assert.assertNotNull(parsedDateWithSingleDoubleDigitDay); Assert.assertEquals(DATE, parsedDateWithSingleDoubleDigitDay); final Date parsedDateWithoutGMT = format.parse("Sun Nov 6 08:49:37 1994"); Assert.assertNotNull(parsedDateWithoutGMT); Assert.assertEquals(DATE, parsedDateWithoutGMT); }
@Test public void testParse() throws ParseException { HttpHeaderDateFormat format = HttpHeaderDateFormat.get(); final Date parsedDateWithSingleDigitDay = format.parse("Sun, 6 Nov 1994 08:49:37 GMT"); assertNotNull(parsedDateWithSingleDigitDay); assertEquals(DATE, parsedDateWithSingleDigitDay); final Date parsedDateWithDoubleDigitDay = format.parse("Sun, 06 Nov 1994 08:49:37 GMT"); assertNotNull(parsedDateWithDoubleDigitDay); assertEquals(DATE, parsedDateWithDoubleDigitDay); final Date parsedDateWithDashSeparatorSingleDigitDay = format.parse("Sunday, 06-Nov-94 08:49:37 GMT"); assertNotNull(parsedDateWithDashSeparatorSingleDigitDay); assertEquals(DATE, parsedDateWithDashSeparatorSingleDigitDay); final Date parsedDateWithSingleDoubleDigitDay = format.parse("Sunday, 6-Nov-94 08:49:37 GMT"); assertNotNull(parsedDateWithSingleDoubleDigitDay); assertEquals(DATE, parsedDateWithSingleDoubleDigitDay); final Date parsedDateWithoutGMT = format.parse("Sun Nov 6 08:49:37 1994"); assertNotNull(parsedDateWithoutGMT); assertEquals(DATE, parsedDateWithoutGMT); }