01: package com.mockrunner.example.struts;
02:
03: import com.mockrunner.struts.BasicActionTestCaseAdapter;
04: import com.mockrunner.struts.MapMessageResources;
05:
06: /**
07: * Example test for the {@link ShoppingCartAction}.
08: */
09: public class ShoppingCartActionTest extends BasicActionTestCaseAdapter {
10: protected void setUp() throws Exception {
11: super .setUp();
12: MapMessageResources resources = new MapMessageResources();
13: resources.putMessage("button.add", "Add");
14: resources.putMessage("button.order", "Order");
15: setResources("test", resources);
16: }
17:
18: public void testForward() {
19: getActionMockObjectFactory().getMockActionMapping()
20: .setParameter("method");
21: addRequestParameter("method", "Add");
22: actionPerform(ShoppingCartAction.class);
23: verifyForward("add");
24: addRequestParameter("method", "Order");
25: actionPerform(ShoppingCartAction.class);
26: verifyForward("order");
27: }
28: }
|