1 18 package org.apache.struts.action; 19 20 import javax.servlet.ServletException ; 21 import junit.framework.Test; 22 import junit.framework.TestSuite; 23 24 import org.apache.cactus.ServletTestCase; 25 import org.apache.struts.util.MessageResources; 26 27 31 public class TestActionServlet extends ServletTestCase 32 { 33 38 public TestActionServlet(String theName) 39 { 40 super(theName); 41 } 42 43 48 public static void main(String [] theArgs) 49 { 50 junit.awtui.TestRunner.main(new String [] {TestActionServlet.class.getName()}); 51 } 52 53 57 public static Test suite() 58 { 59 return new TestSuite(TestActionServlet.class); 61 } 62 63 64 66 67 71 public void testInitDestroyInternal() { 72 73 ActionServlet servlet = new ActionServlet(); 74 try { 75 servlet.initInternal(); 76 } catch (ServletException e) { 77 fail("initInternal() threw exception: " + e); 78 } 79 assertTrue("internal was initialized", 80 servlet.getInternal() != null); 81 assertTrue("internal of correct type", 82 servlet.getInternal() instanceof MessageResources); 83 servlet.destroyInternal(); 84 assertTrue("internal was destroyed", 85 servlet.getInternal() == null); 86 87 } 88 89 90 91 93 97 111 112 116 136 137 } 139 | Popular Tags |