### Question:
JsonUtils { public static Date parseDateRfc822(String str) { if (str != null) { try { SimpleDateFormat dateFormater = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US); dateFormater.setTimeZone(GMT_TZ); return dateFormater.parse(str); } catch (ParseException ex) { return null; } } return null; }  static String formatDateRfc822(Date date, String timeZoneId); static String formatDateRfc822(Date date); static Date parseDateRfc822(String str);  }### Answer:
@Test public void testInvalidDateStr() { Date date = JsonUtils.parseDateRfc822("Xhu, 01 Jan 2009 00:00:00 GMT"); assertEquals(null, date); }
@Test public void testNullDateStr() { assertEquals(null, JsonUtils.parseDateRfc822(null)); }