|
||||||||||
| 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.
MockServletContextpublic MockServletConfig createMockServletConfig()
MockServletConfig using new.
This method can be overridden to return a subclass of MockServletConfig.
MockServletConfigpublic MockHttpServletResponse createMockResponse()
MockHttpServletResponse using new.
This method can be overridden to return a subclass of MockHttpServletResponse.
MockHttpServletResponsepublic MockHttpServletRequest createMockRequest()
MockHttpServletRequest using new.
This method can be overridden to return a subclass of MockHttpServletRequest.
MockHttpServletRequestpublic MockHttpSession createMockSession()
MockHttpSession using new.
This method can be overridden to return a subclass of MockHttpSession.
MockHttpSessionpublic MockPageContext createMockPageContext()
MockPageContext using new.
This method can be overridden to return a subclass of MockPageContext.
MockPageContextpublic MockFilterConfig createMockFilterConfig()
MockFilterConfig using new.
This method can be overridden to return a subclass of MockFilterConfig.
MockFilterConfigpublic MockFilterChain createMockFilterChain()
MockFilterChain using new.
This method can be overridden to return a subclass of MockFilterChain.
MockFilterChainpublic MockServletConfig getMockServletConfig()
MockServletConfig
MockServletConfigpublic MockServletContext getMockServletContext()
MockServletContext.
MockServletContextpublic MockHttpServletRequest getMockRequest()
MockHttpServletRequest.
MockHttpServletRequestpublic MockHttpServletResponse getMockResponse()
MockHttpServletResponse.
MockHttpServletResponsepublic javax.servlet.http.HttpServletRequest getWrappedRequest()
HttpServletRequest. If no
wrapper is specified, this method returns the mock request itself.
HttpServletRequestpublic javax.servlet.http.HttpServletResponse getWrappedResponse()
HttpServletResponse. If no
wrapper is specified, this method returns the mock response itself.
HttpServletRequestpublic MockHttpSession getMockSession()
MockHttpSession.
MockHttpSessionpublic MockHttpSession getSession()
getMockSession()
MockHttpSession.
MockHttpSessionpublic MockPageContext getMockPageContext()
MockPageContext.
MockPageContextpublic MockFilterConfig getMockFilterConfig()
MockFilterConfig.
MockFilterConfigpublic MockFilterChain getMockFilterChain()
MockFilterChain.
MockFilterChainpublic 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 | |||||||||