request.setServerName("localhost");
request.setContextPath("/geoserver");
request.setMethod("GET");
CodeExpectingHttpServletResponse response = new CodeExpectingHttpServletResponse(new MockHttpServletResponse());
request.setupAddParameter("service", "hello");
request.setupAddParameter("request", "httpErrorCodeException");
request.setupAddParameter("version", "1.0.0");
request.setRequestURI(
"http://localhost/geoserver/ows?service=hello&request=hello&message=HelloWorld");
request.setQueryString("service=hello&request=hello&message=HelloWorld");
dispatcher.handleRequest(request, response);
assertEquals(HttpServletResponse.SC_NO_CONTENT, response.getStatusCode());
}