### Question:
OAuthResponse implements OAuthMessage { public static OAuthErrorResponseBuilder errorResponse(int code) { return new OAuthErrorResponseBuilder(code); } protected  OAuthResponse(String uri, int responseStatus); static OAuthResponseBuilder status(int code); static OAuthErrorResponseBuilder errorResponse(int code); @Override String getLocationUri(); @Override void setLocationUri(String uri); @Override String getBody(); @Override void setBody(String body); @Override String getHeader(String name); @Override Map<String, String> getHeaders(); @Override void setHeaders(Map<String, String> headers); int getResponseStatus(); @Override void addHeader(String name, String header);  }### Answer:
@Test public void testErrorResponse() throws Exception { OAuthResponse oAuthResponse = OAuthResponse.errorResponse(400) .setError("error") .setRealm("album") .setState("ok") .setErrorDescription("error_description") .setErrorUri("http: .setParam("param", "value") .buildJSONMessage(); String body = oAuthResponse.getBody(); assertEquals( "{\"param\":\"value\",\"error_description\":\"error_description\",\"realm\":\"album\",\"state\":\"ok\",\"error\":\"error\",\"error_uri\":\"http: body); }