KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > servletunit > struts > tests > TestBadModuleName


1 package servletunit.struts.tests;
2
3 import servletunit.struts.MockStrutsTestCase;
4 import junit.framework.AssertionFailedError;
5
6 /**
7  * Created by IntelliJ IDEA.
8  * User: deryl
9  * Date: Apr 28, 2003
10  * Time: 9:26:32 AM
11  * To change this template use Options | File Templates.
12  */

13 public class TestBadModuleName extends MockStrutsTestCase {
14
15     public TestBadModuleName(String JavaDoc testName) {
16         super(testName);
17     }
18
19     public void setUp() throws Exception JavaDoc {
20         super.setUp();
21         setServletConfigFile("/WEB-INF/web.xml");
22         setConfigFile("tiles","/WEB-INF/struts-config-tiles.xml");
23     }
24
25     public void testBadName() {
26         try {
27         addRequestParameter("username","deryl");
28         addRequestParameter("password","radar");
29         setRequestPathInfo("doesnotexist","/tilesForward");
30         actionPerform();
31         verifyForward("success");
32         verifyForwardPath("/layouts/pageLayout.jsp");
33         } catch (AssertionFailedError afe) {
34             return;
35         }
36         fail("Should have thrown a JUnit error!");
37     }
38
39 }
40
Popular Tags