### Question:
DateHeaderDelegate implements HeaderDelegate<Date> { public String toString(Date date) { if (date == null) { throw new IllegalArgumentException(Messages.getMessage("variableIsNull", "date")); } return HttpDateParser.toHttpDate(date); }  Date fromString(String date); String toString(Date date);  }### Answer:
@Test public void testSerializeHeaderDelegate() throws ParseException { RuntimeDelegate rd = RuntimeDelegate.getInstance(); HeaderDelegate<Date> dateHeaderDelegate = rd.createHeaderDelegate(Date.class); if (dateHeaderDelegate == null) { fail("Date header delegate is not regestered in RuntimeDelegateImpl"); } String expectedDate = RFC1123_DATE; try { SimpleDateFormat dateFormat = new SimpleDateFormat(RFC1123_DATE_FORMAT_PATTERN, Locale.US); Date expectedDate_RFC1123 = dateFormat.parse(RFC1123_DATE); assertEquals(expectedDate, dateHeaderDelegate.toString(expectedDate_RFC1123)); } catch (Exception e) { fail("Failed to write date " + RFC1123_DATE); } try { dateHeaderDelegate.toString(null); fail("Date is null- IllegalArgumentException must be thrown"); } catch (IllegalArgumentException e) { } }