List of usage examples for org.springframework.mock.web MockPageContext MockPageContext
public MockPageContext(@Nullable ServletContext servletContext, @Nullable HttpServletRequest request,
@Nullable HttpServletResponse response)
From source file:org.apache.struts2.StrutsJUnit4TestCase.java
protected void initServletMockObjects() { servletContext = new MockServletContext(resourceLoader); response = new MockHttpServletResponse(); request = new MockHttpServletRequest(); pageContext = new MockPageContext(servletContext, request, response); }
From source file:org.apache.struts2.StrutsJUnit4TestCase.java
public void finishExecution() { HttpSession session = this.request.getSession(); Enumeration attributeNames = session.getAttributeNames(); MockHttpServletRequest nextRequest = new MockHttpServletRequest(); while (attributeNames.hasMoreElements()) { String key = (String) attributeNames.nextElement(); Object attribute = session.getAttribute(key); nextRequest.getSession().setAttribute(key, attribute); }//from ww w . java 2 s .co m this.response = new MockHttpServletResponse(); this.request = nextRequest; this.pageContext = new MockPageContext(servletContext, request, response); }