Search in sources :

Example 1 with MockHttpServletResponse

use of com.mockobjects.servlet.MockHttpServletResponse in project struts by apache.

the class ServletActionContextTest method setUp.

public void setUp() {
    Map<String, Object> extraContext = new HashMap<>();
    request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();
    servletContext = new MockServletContext();
    extraContext.put(HTTP_REQUEST, request);
    extraContext.put(HTTP_RESPONSE, response);
    extraContext.put(SERVLET_CONTEXT, servletContext);
    actionContext = ActionContext.of(extraContext).bind();
}
Also used : HashMap(java.util.HashMap) MockHttpServletRequest(com.mockobjects.servlet.MockHttpServletRequest) MockHttpServletResponse(com.mockobjects.servlet.MockHttpServletResponse) MockServletContext(com.mockobjects.servlet.MockServletContext)

Example 2 with MockHttpServletResponse

use of com.mockobjects.servlet.MockHttpServletResponse in project struts by apache.

the class RolesInterceptorTest method testHandleRejection.

public void testHandleRejection() throws Exception {
    MockHttpServletResponse response = new MockHttpServletResponse();
    response.setExpectedError(response.SC_FORBIDDEN);
    interceptor.handleRejection(null, response);
    response.verify();
}
Also used : MockHttpServletResponse(com.mockobjects.servlet.MockHttpServletResponse)

Aggregations

MockHttpServletResponse (com.mockobjects.servlet.MockHttpServletResponse)2 MockHttpServletRequest (com.mockobjects.servlet.MockHttpServletRequest)1 MockServletContext (com.mockobjects.servlet.MockServletContext)1 HashMap (java.util.HashMap)1