@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..."); }