{
ServletRunner sr = new ServletRunner();
ServletUnitClient sc = sr.newClient();
WebRequest request = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );
InvocationContext ic = sc.newInvocation( request );
OAuth2ProblemException problem = new OAuth2ProblemException(OAuth2.ErrorCode.UNSUPPORTED_RESPONSE_TYPE);
// if you do not specify status code 200 here response does not inluce anything
problem.setParameter(OAuth2ProblemException.HTTP_STATUS_CODE,new Integer(200));
HttpServletResponse hsr = ic.getResponse();
OAuth2Servlet.handleException(ic.getRequest(),hsr,problem,null,true,false);
WebResponse response = ic.getServletResponse();
assertEquals("ErrorJSONResponse Body chcek", "{"+toStringWithQuotation("error")+":"+toStringWithQuotation("unsupported_response_type")+"}", response.getText());
assertEquals("ErrorJSONResponse ContentType check", "application/json", response.getContentType());