private HTTPClientResponseResolver createResponseResolver(
     final HttpMethod httpMethod, final Status status, final Header[] headers) {
   try {
     when(httpMethod.getStatusLine())
         .thenReturn(
             new org.apache.commons.httpclient.StatusLine(
                 String.format("HTTP/1.1 %s %s\r\n", status.getCode(), status.getName())));
   } catch (HttpException e) {
     throw new RuntimeException(e);
   }
   when(httpMethod.getStatusCode()).thenReturn(status.getCode());
   when(httpMethod.getResponseHeaders()).thenReturn(headers);
   return new TestableHTTPClientResponseResolver(httpMethod);
 }
  @Test
  public void testResolveGETWithNoHeaders() throws IOException {
    HTTPRequest request = new HTTPRequest(URI.create("http://dummy/uri/123"), HTTPMethod.GET);
    final HttpMethod method = mock(GetMethod.class);
    HTTPClientResponseResolver resolver =
        createResponseResolver(method, Status.valueOf(200), new Header[0]);

    HTTPResponse response = resolver.resolve(request);
    assertNotNull("Response was null", response);
    assertEquals(200, response.getStatus().getCode());
    assertEquals(0, response.getHeaders().size());
  }
  @Test
  public void testResolvePUTWithNoHeaders() throws IOException {
    HTTPRequest request = new HTTPRequest(URI.create("http://dummy/uri/123"), HTTPMethod.PUT);
    final Payload payload = mock(Payload.class);
    request = request.payload(payload);
    when(payload.getMimeType()).thenReturn(new MIMEType("text/plain"));
    final HttpMethod method = mock(PostMethod.class);
    HTTPClientResponseResolver resolver =
        createResponseResolver(method, Status.valueOf(200), new Header[0]);

    HTTPResponse response = resolver.resolve(request);
    assertNotNull(response);
    assertEquals(200, response.getStatus().getCode());
    assertEquals(0, response.getHeaders().size());
  }