Compatible with Servlet 2.5 and partially with Servlet 3.0 (notable exceptions: the getPart(s)
and startAsync
families of methods).
@author Juergen Hoeller
@author Rod Johnson
@author Rick Evans
@author Mark Fisher
@since 1.0.2
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.1Mock implementation of HttpServletContext
.
Mock implementation of HttpServletContext
.
Mock HttpServletRequest object for low-level unit tests of Struts controller components. Coarser grained tests should be implemented in terms of the Cactus framework, instead of the mock object classes.
WARNING - Only the minimal set of methods needed to create unit tests is provided, plus additional methods to configure this object as necessary. Methods for unsupported operations will throw UnsupportedOperationException
.
WARNING - Because unit tests operate in a single threaded environment, no synchronization is performed.
@version $Rev: 421119 $ $Date: 2006-07-11 21:49:11 -0700 (Tue, 11 Jul 2006) $Used for testing the web framework; also useful for testing application controllers. @author Juergen Hoeller @author Rod Johnson @author Rick Evans @author Mark Fisher @since 1.0.2
Used for testing the web framework; also useful for testing application controllers. @author Juergen Hoeller @author Rod Johnson @author Rick Evans @author Mark Fisher @since 1.0.2
As of Spring 4.0, this set of mocks is designed on a Servlet 3.0 baseline. @author Juergen Hoeller @author Rod Johnson @author Rick Evans @author Mark Fisher @author Chris Beams @author Sam Brannen @author Brian Clozel @since 1.0.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|