HttpCallImpl implements HttpCall<T> { @Override public WebResource.Builder addHeaders(final WebResource webResource, final Map<String, String> headers, final String accept, final String type) { WebResource.Builder builder = webResource.getRequestBuilder(); if (accept != null) { builder.accept(accept); } if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { builder.header(entry.getKey(), entry.getValue()); } } if (type != null) { builder.type(type); } return builder; } @Inject  HttpCallImpl(); @SuppressWarnings("unchecked") @Override T makeRequest(final String httpMethod, final String url, final Object data, final Class<T> toMap,
                         final Map<String, String> headers, final Map<String, String> queryParams,
                         final String accept, final String type, final int expectedStatus); @Override T makeRequest(final String httpMethod, final HttpCallConfig<T> config); @Override WebResource.Builder addHeaders(final WebResource webResource, final Map<String, String> headers,
                                          final String accept, final String type); @Override WebResource addQueryParams(final WebResource webResource, Map<String, String> queryParams); @Override T doGet(final String url, final Class<T> toMap, final Map<String, String> headers,
                   final Map<String, String> queryParams, final String accept, final int expectedStatus); @Override T doPost(final String url, final Object data, final Class<T> toMap, final Map<String, String> headers,
                    final Map<String, String> queryParams, final String accept, final String type,
                    final int expectedStatus); @Override T doPost(final HttpCallConfig<T> httpCallConfig); @Override T doGet(final HttpCallConfig<T> httpCallConfig); @Override T doPut(final HttpCallConfig<T> httpCallConfig); @Override T doDelete(final HttpCallConfig<T> httpCallConfig); @Override T doPut(final String url, final Object data, final Class<T> toMap, final Map<String, String> headers,
                   final Map<String, String> queryParams, final String accept, final String type,
                   final int expectedStatus); @Override T doDelete(final String url, final Class<T> toMap, final Map<String, String> headers,
                      final Map<String, String> queryParams, final String accept, final int expectedStatus);  }
@Test public void testAddHeaders() throws Exception { WebResource webResource = client.resource(url); WebResource.Builder webResourceFromMethod = httpCallsImpl.addHeaders(webResource, map, accept, type); stubFor(get(urlEqualTo("/test")) .withHeader(ACCEPT, equalTo(accept)) .withHeader(CONTENT_TYPE, equalTo(type)) .withHeader("foo", equalTo(map.get("foo"))) .withHeader("dead", equalTo(map.get("dead"))) .willReturn(aResponse().withStatus(ORDINAL_200_OK))); ClientResponse x = webResourceFromMethod.get(ClientResponse.class); assertThat(x.getStatus(), is(ORDINAL_200_OK)); }