### Question:
TraceeHttpClientDecorator extends HttpClient { @Override public int executeMethod(HttpMethod method) throws IOException, HttpException { return this.executeMethod(null, method, null); } TraceeHttpClientDecorator(HttpClient delegate, TraceeBackend backend, HttpHeaderTransport transportSerialization, String profile);   TraceeHttpClientDecorator(HttpClient delegate, TraceeBackend backend, String profile);  TraceeHttpClientDecorator(HttpClient delegate, String profile); static HttpClient wrap(HttpClient httpClient); static HttpClient wrap(HttpClient httpClient, String profile); @Override int executeMethod(HttpMethod method); @Override int executeMethod(HostConfiguration hostConfiguration, HttpMethod method); @Override int executeMethod(HostConfiguration hostconfig, HttpMethod method, HttpState state); @Override synchronized HttpState getState(); @Override synchronized void setState(HttpState state); @Override @SuppressWarnings("deprecation") synchronized void setStrictMode(boolean strictMode); @Override @SuppressWarnings("deprecation") synchronized boolean isStrictMode(); @Override @SuppressWarnings("deprecation") synchronized void setTimeout(int newTimeoutInMilliseconds); @Override @SuppressWarnings("deprecation") synchronized void setHttpConnectionFactoryTimeout(long timeout); @Override @SuppressWarnings("deprecation") synchronized void setConnectionTimeout(int newTimeoutInMilliseconds); @Override @SuppressWarnings("deprecation") String getHost(); @Override @SuppressWarnings("deprecation") int getPort(); @Override synchronized HostConfiguration getHostConfiguration(); @Override synchronized void setHostConfiguration(HostConfiguration hostConfiguration); @Override synchronized HttpConnectionManager getHttpConnectionManager(); @Override synchronized void setHttpConnectionManager(HttpConnectionManager httpConnectionManager); @Override HttpClientParams getParams(); @Override void setParams(HttpClientParams params);  }### Answer:
@Test public void doNotRenderTpicHeaderIfBackendIsEmpty() throws IOException { unit.executeMethod(null, httpMethodMock); verify(httpMethodMock, never()).setRequestHeader(anyString(), anyString()); }
@Test public void testContextWrittenToRequest() throws IOException { backendMock.put("foo", "bar"); when(transportSerializationMock.render(anyMapOf(String.class, String.class))).thenReturn("foo=bar"); unit.executeMethod(httpMethodMock); verify(httpMethodMock).setRequestHeader(eq(TraceeConstants.TPIC_HEADER), eq("foo=bar")); }
@Test public void testContextParsedFromResponse() throws IOException { final Header responseHeader = new Header(TraceeConstants.TPIC_HEADER, "foo=bar"); final Header[] responseHeaders = new Header[]{responseHeader}; when(httpMethodMock.getResponseHeaders(eq(TraceeConstants.TPIC_HEADER))).thenReturn(responseHeaders); when(httpMethodMock.isRequestSent()).thenReturn(true); unit.executeMethod(null, httpMethodMock, null); verify(transportSerializationMock).parse(eq(Collections.singletonList("foo=bar"))); verify(backendMock).putAll(Mockito.anyMapOf(String.class, String.class)); }