@Test public void testToResponse() throws Exception { OauthExceptionMapper mapper = new OauthExceptionMapper(); OauthException exception = new OauthException("invalid_client", "Invalid credentials"); Response response = mapper.toResponse(exception); assertEquals(400, response.getStatus()); assertEquals("invalid_client", ((Map)response.getEntity()).get("error")); assertEquals("Invalid credentials", ((Map)response.getEntity()).get("error_description")); }
@Override public Response toResponse(OauthException e) { return Response.status(400) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of("error", e.getError(), "error_description", e.getErrorDescription())) .build(); }
OauthExceptionMapper implements ExceptionMapper<OauthException> { @Override public Response toResponse(OauthException e) { return Response.status(400) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of("error", e.getError(), "error_description", e.getErrorDescription())) .build(); } }
OauthExceptionMapper implements ExceptionMapper<OauthException> { @Override public Response toResponse(OauthException e) { return Response.status(400) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of("error", e.getError(), "error_description", e.getErrorDescription())) .build(); }  }
OauthExceptionMapper implements ExceptionMapper<OauthException> { @Override public Response toResponse(OauthException e) { return Response.status(400) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of("error", e.getError(), "error_description", e.getErrorDescription())) .build(); }  @Override Response toResponse(OauthException e); }
OauthExceptionMapper implements ExceptionMapper<OauthException> { @Override public Response toResponse(OauthException e) { return Response.status(400) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of("error", e.getError(), "error_description", e.getErrorDescription())) .build(); }  @Override Response toResponse(OauthException e);  }