@Test(expected = IOException.class)
 public void testResolveFailingGET() throws IOException {
   HTTPRequest request = new HTTPRequest(URI.create("http://dummy/uri/123"), HTTPMethod.GET);
   final HttpMethod method = mock(GetMethod.class);
   HTTPClientResponseResolver resolver = new TestableHTTPClientResponseResolver(method);
   when(httpClient.executeMethod(method)).thenThrow(new IOException("Connection error"));
   resolver.resolve(request);
   fail("No exception was thrown...");
 }
  @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());
  }