Search in sources :

Example 1 with GrailsMockHttpServletResponse

use of org.grails.plugins.testing.GrailsMockHttpServletResponse in project grails-core by grails.

the class MockGrailsApplication method bindMockHttpRequest.

private GrailsWebRequest bindMockHttpRequest() {
    GrailsMockHttpServletRequest mockRequest = new GrailsMockHttpServletRequest();
    GrailsMockHttpServletResponse mockResponse = new GrailsMockHttpServletResponse();
    GrailsWebRequest webRequest = new GrailsWebRequest(mockRequest, mockResponse, mockRequest.getServletContext());
    mockRequest.setAttribute(GrailsApplicationAttributes.WEB_REQUEST, webRequest);
    RequestContextHolder.setRequestAttributes(webRequest);
    return webRequest;
}
Also used : GrailsMockHttpServletRequest(org.grails.plugins.testing.GrailsMockHttpServletRequest) GrailsWebRequest(org.grails.web.servlet.mvc.GrailsWebRequest) GrailsMockHttpServletResponse(org.grails.plugins.testing.GrailsMockHttpServletResponse)

Aggregations

GrailsMockHttpServletRequest (org.grails.plugins.testing.GrailsMockHttpServletRequest)1 GrailsMockHttpServletResponse (org.grails.plugins.testing.GrailsMockHttpServletResponse)1 GrailsWebRequest (org.grails.web.servlet.mvc.GrailsWebRequest)1