@Test
 public void testInjectedHttpClient() throws IOException {
   final DefaultHttpClient httpClient =
       new DefaultHttpClient(HttpClientUtils.createDefaultHttpParams());
   HttpClientUtils.enableCompression(httpClient);
   final SardineHttpClientImpl sardine = new SardineHttpClientImpl(httpClient);
   checkMultipleResources(toMap(sardine.list(SVN_BASE_URL)));
 }
 @Test(expected = HttpResponseException.class)
 public void testExpectationFailedTwice() throws ClientProtocolException, IOException {
   final String uri = "http://example.com/";
   final HttpPut request = new HttpPut(uri);
   final SardineHttpClientImpl sardine =
       new SardineHttpClientImpl(new DefaultHttpClient()) {
         /** {@inheritDoc} */
         @Override
         <T> T wrapResponseHandlerExceptions(
             HttpRequestBase request, ResponseHandler<T> responseHandler) throws IOException {
           throw new HttpResponseException(HttpStatus.SC_EXPECTATION_FAILED, "Expectation failed");
         }
       };
   sardine.put(uri, request, new StringEntity("hallo"), "text/xml", true);
 }
 @Test
 public void wrapResponseHandlerExceptionsAuthenticationException() throws IOException {
   SardineHttpClientImpl sut =
       new SardineHttpClientImpl() {
         /** {@inheritDoc} */
         @Override
         void setAuthenticationOnMethod(HttpRequestBase base) throws AuthenticationException {
           throw new AuthenticationException();
         }
       };
   try {
     sut.wrapResponseHandlerExceptions(new HttpGet(SVN_BASE_URL), new BasicResponseHandler());
   } catch (IOException e) {
     assertEquals(AuthenticationException.class, e.getCause().getClass());
   }
 }
 @Test(expected = IOException.class)
 public void wrapResponseHandlerExceptionsIOException() throws IOException {
   ((SardineHttpClientImpl) sardine)
       .wrapResponseHandlerExceptions(
           new HttpGet(SVN_BASE_URL),
           new ResponseHandler<Void>() {
             public Void handleResponse(HttpResponse response)
                 throws ClientProtocolException, IOException {
               throw new IOException();
             }
           });
 }
 @Test
 public void testIsStatusExpectationFailedAndEntityRepeatable()
     throws UnsupportedEncodingException {
   final SardineHttpClientImpl sardine = new SardineHttpClientImpl(new DefaultHttpClient());
   final HttpResponseException exceptionExpectationFailed =
       new HttpResponseException(HttpStatus.SC_EXPECTATION_FAILED, "Expectation failed");
   final HttpResponseException otherException =
       new HttpResponseException(HttpStatus.SC_CONFLICT, "Conflict");
   final StringEntity repeatableEntity = new StringEntity("hallo");
   final InputStreamEntity nonRepeatableEntity =
       new InputStreamEntity(new ByteArrayInputStream("hallo".getBytes()), -1);
   assertTrue(repeatableEntity.isRepeatable());
   assertFalse(nonRepeatableEntity.isRepeatable());
   assertTrue(
       sardine.isStatusExpectationFailedAndEntityRepeatable(
           exceptionExpectationFailed, repeatableEntity));
   assertFalse(
       sardine.isStatusExpectationFailedAndEntityRepeatable(otherException, repeatableEntity));
   assertFalse(
       sardine.isStatusExpectationFailedAndEntityRepeatable(
           exceptionExpectationFailed, nonRepeatableEntity));
   assertFalse(
       sardine.isStatusExpectationFailedAndEntityRepeatable(otherException, nonRepeatableEntity));
 }