Mock implementation of an HttpServletRequest object. Allows for setting most values that are likely to be of interest (and can always be subclassed to affect others). Of key interest and perhaps not completely obvious, the way to get request parameters into an instance of MockHttpServletRequest is to fetch the parameter map using getParameterMap() and use the put() and putAll() methods on it. Values must be String arrays. Examples follow:
MockHttpServletRequest req = new MockHttpServletRequest("/foo", "/bar.action"); req.getParameterMap().put("param1", new String[] {"value"}); req.getParameterMap().put("param2", new String[] {"value1", "value2"});
It should also be noted that unless you generate an instance of MockHttpSession (or another implementation of HttpSession) and set it on the request, then your request will never have a session associated with it.
@author Tim Fennell
@since Stripes 1.1.1