1 17 package servletunit.struts.tests; 18 19 import servletunit.struts.MockStrutsTestCase; 20 import junit.framework.AssertionFailedError; 21 22 public class TestTilesForward extends MockStrutsTestCase { 23 24 public TestTilesForward(String testName) { 25 super(testName); 26 } 27 28 public void setUp() throws Exception { 29 super.setUp(); 30 setConfigFile("tiles","/WEB-INF/struts-config-tiles.xml"); 31 setServletConfigFile("/WEB-INF/web.xml"); 32 setConfigFile("/WEB-INF/struts-config.xml"); 33 } 34 35 36 public void testTilesForward() { 37 addRequestParameter("username","deryl"); 38 addRequestParameter("password","radar"); 39 setRequestPathInfo("tiles","/tilesForward.do"); 40 actionPerform(); 41 verifyForward("success"); 42 verifyForwardPath("/layouts/pageLayout.jsp"); 43 verifyTilesForward("success","page.library"); 44 } 45 46 public void testTilesInputForward() { 47 setRequestPathInfo("tiles","/tilesInputForward.do"); 48 actionPerform(); 49 verifyInputForward(); 50 verifyInputTilesForward("page.library"); 51 } 52 53 public void testTileForwardFail() { 54 addRequestParameter("username","deryl"); 55 addRequestParameter("password","radar"); 56 setRequestPathInfo("tiles","/tilesForward.do"); 57 actionPerform(); 58 verifyForward("success"); 59 verifyForwardPath("/layouts/pageLayout.jsp"); 60 try { 61 verifyTilesForward("success","foo.fail"); 62 } catch (AssertionFailedError afe) { 63 return; 64 } 65 fail("Should have failed."); 66 } 67 68 84 85 } 86 | Popular Tags |