1 package servletunit.struts.tests; 17 18 import servletunit.struts.*; 19 import java.io.File ; 20 21 29 public class TestNullPointerAction extends MockStrutsTestCase { 30 31 public TestNullPointerAction() { 32 } 33 34 public void setUp() throws Exception { 35 super.setUp(); 36 this.setContextDirectory(new File (System.getProperty("basedir") + "/src/examples")); 37 setConfigFile("/WEB-INF/struts-config-test.xml"); 38 } 39 40 public void testNullPointer() throws Exception { 41 try{ 42 this.setRequestPathInfo("/testNullPointer"); 43 this.actionPerform(); 44 fail("Exception expected"); 45 }catch(ExceptionDuringTestError e){ 46 } 50 } 51 52 public void testNullPointerFromForm() throws Exception { 53 try{ 54 this.setRequestPathInfo("/testNullPointerForm"); 55 this.actionPerform(); 56 fail("Exception expected"); 57 }catch(ExceptionDuringTestError e){ 58 } 62 } 63 64 65 public static void main(String [] args) { 66 junit.textui.TestRunner.run(TestNullPointerAction.class); 67 } 68 69 } 70 | Popular Tags |