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); }