TokenErrorResponse r = new TokenErrorResponse(err);
assertEquals(OAuth2Error.INVALID_REQUEST, r.getErrorObject());
HTTPResponse httpResponse = r.toHTTPResponse();
assertEquals(HTTPResponse.SC_BAD_REQUEST, httpResponse.getStatusCode());
assertEquals(CommonContentTypes.APPLICATION_JSON, httpResponse.getContentType());
assertEquals("no-store", httpResponse.getCacheControl());
assertEquals("no-cache", httpResponse.getPragma());
JSONObject jsonObject = JSONObjectUtils.parseJSONObject(httpResponse.getContent());
assertEquals(OAuth2Error.INVALID_REQUEST.getCode(), (String)jsonObject.get("error"));
assertEquals(OAuth2Error.INVALID_REQUEST.getDescription(), (String)jsonObject.get("error_description"));
assertEquals(ERROR_PAGE_URI.toString(), (String)jsonObject.get("error_uri"));
assertEquals(3, jsonObject.size());