|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mockrunner.mock.web.WebMockObjectFactory
public class WebMockObjectFactory
Used to create all types of web mock objects. Maintains the necessary dependencies between the mock objects. If you use the mock objects returned by this factory in your tests you can be sure that they are all up to date.
Constructor Summary | |
---|---|
WebMockObjectFactory()
Creates a new set of mock objects. |
|
WebMockObjectFactory(WebMockObjectFactory factory)
Creates a set of mock objects based on another one. |
|
WebMockObjectFactory(WebMockObjectFactory factory,
boolean createNewSession)
Creates a set of mock objects based on another one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WebMockObjectFactory()
public WebMockObjectFactory(WebMockObjectFactory factory)
ServletContext
.
factory
- the other factoryBaseTestCase.createWebMockObjectFactory(WebMockObjectFactory)
public WebMockObjectFactory(WebMockObjectFactory factory, boolean createNewSession)
ServletContext
anyway.
factory
- the other factorycreateNewSession
- true
creates a new session,
false
uses the session from factoryBaseTestCase.createWebMockObjectFactory(WebMockObjectFactory, boolean)
Method Detail |
---|
public void refresh()
public MockServletContext createMockServletContext()
MockServletContext
using new
.
This method can be overridden to return a subclass of MockServletContext
.
MockServletContext
public MockServletConfig createMockServletConfig()
MockServletConfig
using new
.
This method can be overridden to return a subclass of MockServletConfig
.
MockServletConfig
public MockHttpServletResponse createMockResponse()
MockHttpServletResponse
using new
.
This method can be overridden to return a subclass of MockHttpServletResponse
.
MockHttpServletResponse
public MockHttpServletRequest createMockRequest()
MockHttpServletRequest
using new
.
This method can be overridden to return a subclass of MockHttpServletRequest
.
MockHttpServletRequest
public MockHttpSession createMockSession()
MockHttpSession
using new
.
This method can be overridden to return a subclass of MockHttpSession
.
MockHttpSession
public MockPageContext createMockPageContext()
MockPageContext
using new
.
This method can be overridden to return a subclass of MockPageContext
.
MockPageContext
public MockFilterConfig createMockFilterConfig()
MockFilterConfig
using new
.
This method can be overridden to return a subclass of MockFilterConfig
.
MockFilterConfig
public MockFilterChain createMockFilterChain()
MockFilterChain
using new
.
This method can be overridden to return a subclass of MockFilterChain
.
MockFilterChain
public MockServletConfig getMockServletConfig()
MockServletConfig
MockServletConfig
public MockServletContext getMockServletContext()
MockServletContext
.
MockServletContext
public MockHttpServletRequest getMockRequest()
MockHttpServletRequest
.
MockHttpServletRequest
public MockHttpServletResponse getMockResponse()
MockHttpServletResponse
.
MockHttpServletResponse
public javax.servlet.http.HttpServletRequest getWrappedRequest()
HttpServletRequest
. If no
wrapper is specified, this method returns the mock request itself.
HttpServletRequest
public javax.servlet.http.HttpServletResponse getWrappedResponse()
HttpServletResponse
. If no
wrapper is specified, this method returns the mock response itself.
HttpServletRequest
public MockHttpSession getMockSession()
MockHttpSession
.
MockHttpSession
public MockHttpSession getSession()
getMockSession()
MockHttpSession
.
MockHttpSession
public MockPageContext getMockPageContext()
MockPageContext
.
MockPageContext
public MockFilterConfig getMockFilterConfig()
MockFilterConfig
.
MockFilterConfig
public MockFilterChain getMockFilterChain()
MockFilterChain
.
MockFilterChain
public void addRequestWrapper(java.lang.Class wrapper)
getWrappedRequest()
. The method getMockRequest()
returns the mock request without any wrapper.
Usually the wrapper is of type javax.servlet.http.HttpServletRequestWrapper
.
That's not absolutely necessary but the wrapper must define a constructor
that takes a single javax.servlet.http.HttpServletRequest
argument
and must implement javax.servlet.http.HttpServletRequest
.
wrapper
- the wrapper classpublic void addRequestWrapper(javax.servlet.http.HttpServletRequest wrapper)
getWrappedRequest()
. The method getMockRequest()
returns the mock request without any wrapper. Usually the wrapper is
an instance of javax.servlet.http.HttpServletRequestWrapper
and wraps the current request but that's not absolutely necessary.
However, be careful if you want to add custom mock versions of
javax.servlet.http.HttpServletRequest
.
wrapper
- the request wrapperpublic void addResponseWrapper(java.lang.Class wrapper)
getWrappedResponse()
. The method getMockResponse()
returns the mock response without any wrapper.
Usually the wrapper is of type javax.servlet.http.HttpServletResponseWrapper
.
That's not absolutely necessary but the wrapper must define a constructor
that takes a single javax.servlet.http.HttpServletResponse
argument
and must implement javax.servlet.http.HttpServletResponse
.
wrapper
- the wrapper classpublic void addResponseWrapper(javax.servlet.http.HttpServletResponse wrapper)
getWrappedResponse()
. The method getMockResponse()
returns the mock response without any wrapper. Usually the wrapper is
an instance of javax.servlet.http.HttpServletResponseWrapper
and wraps the current response but that's not absolutely necessary.
However, be careful if you want to add custom mock versions of
javax.servlet.http.HttpServletResponse
.
wrapper
- the wrapper
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |