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