@Override
    public BackgroundException map(final SardineException failure) {
        final StringBuilder buffer = new StringBuilder();
        switch(failure.getStatusCode()) {
            case HttpStatus.SC_OK:
            case HttpStatus.SC_MULTI_STATUS:
                // HTTP method status
                this.append(buffer, failure.getMessage());
                // Failure unmarshalling XML response
                return new InteroperabilityException(buffer.toString(), failure);
        }
        this.append(buffer, String.format("%s (%d %s)", failure.getReasonPhrase(), failure.getStatusCode(), failure.getResponsePhrase()));
        return super.map(failure, buffer, failure.getStatusCode());
    }
@Test
    public void testMap() {
        Assert.assertEquals(LoginFailureException.class,
            new DAVExceptionMappingService().map(new SardineException("m", 401, "r")).getClass());
        assertEquals(AccessDeniedException.class,
            new DAVExceptionMappingService().map(new SardineException("m", 403, "r")).getClass());
        assertEquals(NotfoundException.class,
            new DAVExceptionMappingService().map(new SardineException("m", 404, "r")).getClass());
    }