OK, I searched the Spring forums for an answer before I posted this so maybe its never been asked before.
I'm trying to use JUnit to test an action which extends AbstractAction using code like the following:
I'm assuming I need to tell event to return me some information in order to determine whether the action did what it is supposed to do. The methods that look like they ought to be what I need (getParameter, getAttribute, getParameters) all return null when I pass the name of known parameters. What am I doing wrong?Code:public class TestStandardVariableAction extends TestCase { public void testDoExecuteRequestContext() throws Exception { MockRequestContext context = new MockRequestContext(); StandardVariableAction action = new StandardVariableAction(); Event event = action.execute(context); . . .
BTW, here's a snippet of the code that inserts data into the RequestContext from the action's doExecute method.
Code:now.put("ampm",cal.get(Calendar.AM_PM)); context.getRequestScope().setAttribute("now",now);


Reply With Quote