@SuppressWarnings("unchecked")
@Test
public void transformsObjectToStringWithHeaderDelegate() throws Exception {

    RuntimeDelegate runtimeDelegate = mock(RuntimeDelegate.class);
    RuntimeDelegate.setInstance(runtimeDelegate);
    HeaderDelegate<String> headerDelegate = mock(HeaderDelegate.class);
    when(runtimeDelegate.createHeaderDelegate(String.class)).thenReturn(headerDelegate);
    when(headerDelegate.toString("foo")).thenReturn("<foo>");
    assertEquals("<foo>", HeaderHelper.getHeaderAsString("foo"));
}