1 18 package org.apache.struts.taglib.bean; 19 20 import java.io.IOException ; 21 22 import javax.servlet.ServletException ; 23 24 import junit.framework.Test; 25 import junit.framework.TestSuite; 26 27 import org.apache.cactus.WebResponse; 28 import org.apache.struts.taglib.TaglibTestBase; 29 30 35 public class TestResourceTag extends TaglibTestBase { 36 37 42 public TestResourceTag(String theName) { 43 super(theName); 44 } 45 46 51 public static void main(String [] theArgs) { 52 junit.awtui.TestRunner.main(new String [] {TestResourceTag.class.getName()}); 53 } 54 55 59 public static Test suite() { 60 return new TestSuite(TestResourceTag.class); 62 } 63 64 65 private void formatAndTest(String compare, String output) { 66 output = replace(output,"\r",""); 68 output = replace(output,"\n",""); 69 output = output.trim(); 70 assertEquals(compare, output); 72 } 73 74 public void testResourceTag() throws IOException , ServletException { 75 request.setAttribute("runTest", "testResourceTag"); 76 pageContext.forward("/test/org/apache/struts/taglib/bean/TestResourceTag.jsp"); 77 } 78 public void endResourceTag(WebResponse response){ 79 formatAndTest("Test Value", response.getText()); 80 } 81 82 public void testResourceTagInput() throws IOException , ServletException { 83 request.setAttribute("runTest", "testResourceTagInput"); 84 pageContext.forward("/test/org/apache/struts/taglib/bean/TestResourceTag.jsp"); 85 } 86 public void endResourceTagInput(WebResponse response){ 87 formatAndTest("Test Value", response.getText()); 88 } 89 90 91 } 92 | Popular Tags |