AcceptLanguageHeaderDelegate implements RuntimeDelegate.HeaderDelegate<AcceptLanguage> { @Override public String toString(AcceptLanguage language) { if (language == null) { throw new IllegalArgumentException(); } return language.getLanguage().toString(); }  @Override AcceptLanguage fromString(String header); @Override String toString(AcceptLanguage language);  }
@UseDataProvider("forTestAcceptLanguageToString") @Test public void testAcceptLanguageToString(AcceptLanguage acceptLanguage, String expectedResult) { AcceptLanguageHeaderDelegate headerDelegate = new AcceptLanguageHeaderDelegate(); assertEquals(expectedResult, headerDelegate.toString(acceptLanguage)); }
@Test(expected = IllegalArgumentException.class) public void throwExceptionWhenAcceptLanguageIsNull() { new AcceptLanguageHeaderDelegate().toString(null); }