Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Method Name

Description

executeAction(String)

Pass the url for the action, and it will return the output of the action. This output is not the action result, like "success", but what would be written to the result stream. To use this the actions must be using a result type that can be read from the classpath, like FreeMarker, velocity, etc (if you are using the experimental Embedded JSP Plugin, you can use JSPs also)

getActionProxy(String)

Builds an action proxy that can be used to invoke an action, by calling execute() on the returned proxy object. The return value of execute() is the action result, like "success"

getActionMapping(String)

Gets an ActionMapping for the url

injectStrutsDependencies(object)

Injects Struts dependencies into an object (dependencies are marked with Inject)

findValueAfterExecute(String)

Finds an object in the value stack, after an action has been executed

applyAdditionalParams(ActionContext context)

Can be overwritten in subclass to provide additional params and settings used during action invocation

Field

Description

MockHttpServletRequest request

The request that will be passed to Struts. Make sure to set parameters in this object before calling methods like getActionProxy

MockHttpServletResponse response

The response object passed to Struts, you can use this class to test the output, response headers, etc

MockServletContext servletContext

The servlet context object passed to Struts

...