DateHeaderDelegate implements RuntimeDelegate.HeaderDelegate<Date> { @Override public String toString(Date date) { if (date == null) { throw new IllegalArgumentException(); } return HeaderHelper.formatDate(date); }  @Override Date fromString(String header); @Override String toString(Date date);  }
@Test public void testToString() throws Exception { Date date = date(2010, 1, 8, 2, 5, 0, "EET"); assertEquals("Fri, 08 Jan 2010 00:05:00 GMT", dateHeaderDelegate.toString(date)); }
@Test(expected = IllegalArgumentException.class) public void throwsExceptionWhenDateIsNull() throws Exception { dateHeaderDelegate.toString(null); }