private static Response.ResponseBuilder encode503ResponseInternal(Exception exception) { return encodeExceptionResponse(exception, 503); }
@Override public Response toResponse(TooManyRequestsException exception) { return ExceptionMappers.encodeExceptionResponse(exception, TOO_MANY_REQUESTS_429) .build(); } }
@Test public void canSerializeExceptions() throws IOException { Response exceptionResponse = ExceptionMappers.encodeExceptionResponse( SERVICE_NOT_AVAILABLE_EXCEPTION, STATUS_CODE).build(); Object exceptionEntity = exceptionResponse.getEntity(); String serializedException = MAPPER.writeValueAsString(exceptionEntity); String expected = getNormalizedRepresentationOfExpectedJson(); assertThat(serializedException).isEqualTo(expected); }
private static Response.ResponseBuilder encode503ResponseInternal(Exception exception) { return encodeExceptionResponse(exception, 503); }
@Override public Response toResponse(TooManyRequestsException exception) { return ExceptionMappers.encodeExceptionResponse(exception, TOO_MANY_REQUESTS_429) .build(); } }