@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()); }
@Override public BackgroundException map(final SardineException failure) { final StringBuilder buffer = new StringBuilder(); switch(failure.getStatusCode()) { case HttpStatus.SC_OK: case HttpStatus.SC_MULTI_STATUS: this.append(buffer, failure.getMessage()); 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()); }
DAVExceptionMappingService extends HttpResponseExceptionMappingService<SardineException> { @Override public BackgroundException map(final SardineException failure) { final StringBuilder buffer = new StringBuilder(); switch(failure.getStatusCode()) { case HttpStatus.SC_OK: case HttpStatus.SC_MULTI_STATUS: this.append(buffer, failure.getMessage()); 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()); } }
DAVExceptionMappingService extends HttpResponseExceptionMappingService<SardineException> { @Override public BackgroundException map(final SardineException failure) { final StringBuilder buffer = new StringBuilder(); switch(failure.getStatusCode()) { case HttpStatus.SC_OK: case HttpStatus.SC_MULTI_STATUS: this.append(buffer, failure.getMessage()); 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()); }  }
DAVExceptionMappingService extends HttpResponseExceptionMappingService<SardineException> { @Override public BackgroundException map(final SardineException failure) { final StringBuilder buffer = new StringBuilder(); switch(failure.getStatusCode()) { case HttpStatus.SC_OK: case HttpStatus.SC_MULTI_STATUS: this.append(buffer, failure.getMessage()); 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()); }  @Override BackgroundException map(final SardineException failure); }
DAVExceptionMappingService extends HttpResponseExceptionMappingService<SardineException> { @Override public BackgroundException map(final SardineException failure) { final StringBuilder buffer = new StringBuilder(); switch(failure.getStatusCode()) { case HttpStatus.SC_OK: case HttpStatus.SC_MULTI_STATUS: this.append(buffer, failure.getMessage()); 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()); }  @Override BackgroundException map(final SardineException failure);  }