|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mockrunner.mock.web.WebMockObjectFactory com.mockrunner.mock.web.ActionMockObjectFactory
public class ActionMockObjectFactory
Used to create all types of struts 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 | |
---|---|
ActionMockObjectFactory()
Creates a new set of mock objects. |
|
ActionMockObjectFactory(WebMockObjectFactory factory)
Creates a set of mock objects based on another one. |
|
ActionMockObjectFactory(WebMockObjectFactory factory,
boolean createNewSession)
Creates a set of mock objects based on another one. |
Method Summary | |
---|---|
MockActionMapping |
createMockActionMapping()
Creates the MockActionMapping using new . |
MockActionServlet |
createMockActionServlet()
Creates the MockActionServlet using new . |
MockModuleConfig |
createMockModuleConfig()
Creates the MockModuleConfig using new . |
org.apache.struts.action.ActionMapping |
getActionMapping()
Returns the ActionMapping . |
MockActionMapping |
getMockActionMapping()
Returns the MockActionMapping . |
MockActionServlet |
getMockActionServlet()
Returns the MockActionServlet . |
MockModuleConfig |
getMockModuleConfig()
Returns the MockModuleConfig . |
org.apache.struts.action.ActionMapping |
prepareActionMapping(java.lang.Class mappingClass)
Prepares an ActionMapping . |
void |
refresh()
Refreshes the mock objects dependencies. |
void |
resetActionMapping()
Resets ActionMapping configuration, i.e. sets
the current ActionMapping returned by getActionMapping()
to the mock action mapping returned by getMockActionMapping() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ActionMockObjectFactory()
public ActionMockObjectFactory(WebMockObjectFactory factory)
ServletContext
.
factory
- the other factoryBaseTestCase.createWebMockObjectFactory(WebMockObjectFactory)
public ActionMockObjectFactory(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()
refresh
in class WebMockObjectFactory
public MockActionServlet createMockActionServlet()
MockActionServlet
using new
.
This method can be overridden to return a subclass of MockActionServlet
.
MockActionServlet
public MockModuleConfig createMockModuleConfig()
MockModuleConfig
using new
.
This method can be overridden to return a subclass of MockModuleConfig
.
MockModuleConfig
public MockActionMapping createMockActionMapping()
MockActionMapping
using new
.
This method can be overridden to return a subclass of MockActionMapping
.
MockActionMapping
public org.apache.struts.action.ActionMapping prepareActionMapping(java.lang.Class mappingClass)
ActionMapping
. If your actions rely
on a custom subclass of ActionMapping
, use this
method to prepare it. Since ActionTestModule
relies on the behaviour of MockActionMapping
,
this method creates a subclass CGLib proxy of the specified mapping class.
You can cast the returned ActionMapping
to your custom
mapping class and the subclass proxy will redirect the necessary
methods to the MockActionMapping
.
Redirected are methods for retrieving forwards. If an ActionMapping
is prepared, getActionMapping()
returns the prepared mapping while
getMockActionMapping()
returns the the underlying MockActionMapping
.
This method relies on CGLib. CGLib is not required by the Struts test framework
if this method is not used.
mappingClass
- the class of the custom action mapping
public void resetActionMapping()
ActionMapping
configuration, i.e. sets
the current ActionMapping
returned by getActionMapping()
to the mock action mapping returned by getMockActionMapping()
.
public org.apache.struts.action.ActionMapping getActionMapping()
ActionMapping
. Unless you prepare an
ActionMapping
using prepareActionMapping(java.lang.Class)
,
this method returns the same object as getMockActionMapping()
.
If an ActionMapping
is prepared, this method returns
the prepared ActionMapping
while getMockActionMapping()
returns the underlying MockActionMapping
.
ActionMapping
public MockActionMapping getMockActionMapping()
MockActionMapping
.
MockActionMapping
public MockModuleConfig getMockModuleConfig()
MockModuleConfig
.
MockModuleConfig
public MockActionServlet getMockActionServlet()
MockActionServlet
.
MockActionServlet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |