### Question:
URLFetchUtils { static Date parseDate(String dateString) { try { return DATE_FORMAT.parseDateTime(dateString).toDate(); } catch (IllegalArgumentException e) { return null; } } private  URLFetchUtils();   }### Answer:
@Test public void testParseDateRoundtrip() { Date now = new Date((System.currentTimeMillis() / 1000) * 1000); String printed = URLFetchUtils.DATE_FORMAT.print(now.getTime()); assertEquals(now.getTime(), URLFetchUtils.parseDate(printed).getTime()); }
@Test public void testParseDateSampleDate() { String printed = "Tue, 22 Oct 2013 19:28:45 GMT"; Date date = URLFetchUtils.parseDate(printed); assertNotNull(date); DateTimeFormatter gcsFormat = DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss z").withZoneUTC() .withLocale(Locale.US); assertEquals(printed.substring(0, printed.length() - 4), gcsFormat.print(date.getTime()).substring(0, printed.length() - 4)); }