1 18 package org.apache.struts.taglib.html; 19 20 import java.util.ArrayList ; 21 import java.util.HashMap ; 22 import java.util.Locale ; 23 import java.util.StringTokenizer ; 24 25 import javax.servlet.jsp.PageContext ; 26 import junit.framework.Test; 27 import junit.framework.TestSuite; 28 29 import org.apache.cactus.JspTestCase; 30 import org.apache.struts.Globals; 31 import org.apache.struts.taglib.SimpleBeanForTesting; 32 33 38 public class TestHiddenTag2 extends JspTestCase { 39 40 45 public TestHiddenTag2(String theName) { 46 super(theName); 47 } 48 49 54 public static void main(String [] theArgs) { 55 junit.awtui.TestRunner.main(new String [] {TestHiddenTag2.class.getName()}); 56 } 57 58 62 public static Test suite() { 63 return new TestSuite(TestHiddenTag2.class); 65 } 66 67 private void runMyTest(String whichTest, String locale) throws Exception { 68 pageContext.setAttribute(Globals.LOCALE_KEY, new Locale (locale, locale), PageContext.SESSION_SCOPE); 69 pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE); 70 request.setAttribute("runTest", whichTest); 71 pageContext.forward("/test/org/apache/struts/taglib/html/TestHiddenTag2.jsp"); 72 } 73 74 77 78 public void testHiddenPropertyStyle() throws Exception { 79 runMyTest("testHiddenPropertyStyle", ""); 80 } 81 82 public void testHiddenPropertyStyleClass() throws Exception { 83 runMyTest("testHiddenPropertyStyleClass", ""); 84 } 85 86 public void testHiddenPropertyStyleId() throws Exception { 87 runMyTest("testHiddenPropertyStyleId", ""); 88 } 89 90 public void testHiddenPropertyTitle() throws Exception { 91 runMyTest("testHiddenPropertyTitle", ""); 92 } 93 94 public void testHiddenPropertyTitleKey() throws Exception { 95 runMyTest("testHiddenPropertyTitleKey", ""); 96 } 97 98 public void testHiddenPropertyTitleKey_fr() throws Exception { 99 runMyTest("testHiddenPropertyTitleKey_fr", "fr"); 100 } 101 102 public void testHiddenPropertyValue() throws Exception { 103 runMyTest("testHiddenPropertyValue", ""); 104 } 105 106 public void testHiddenPropertyIndexedArray() throws Exception { 107 ArrayList lst = new ArrayList (); 108 lst.add("Test Message"); 109 pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE); 110 runMyTest("testHiddenPropertyIndexedArray", ""); 111 } 112 113 public void testHiddenPropertyIndexedArrayProperty() throws Exception { 114 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 115 ArrayList lst = new ArrayList (); 116 lst.add("Test Message"); 117 sbft.setList(lst); 118 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 119 runMyTest("testHiddenPropertyIndexedArrayProperty", ""); 120 } 121 122 public void testHiddenPropertyIndexedMap() throws Exception { 123 HashMap map = new HashMap (); 124 map.put("tst1", "Test Message"); 125 pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE); 126 runMyTest("testHiddenPropertyIndexedMap", ""); 127 } 128 129 public void testHiddenPropertyIndexedMapProperty() throws Exception { 130 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 131 HashMap map = new HashMap (); 132 map.put("tst1", "Test Message"); 133 sbft.setMap(map); 134 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 135 runMyTest("testHiddenPropertyIndexedMapProperty", ""); 136 } 137 138 public void testHiddenPropertyIndexedEnumeration() throws Exception { 139 StringTokenizer st = new StringTokenizer ("Test Message"); 140 pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE); 141 runMyTest("testHiddenPropertyIndexedEnumeration", ""); 142 } 143 144 public void testHiddenPropertyIndexedEnumerationProperty() throws Exception { 145 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 146 StringTokenizer st = new StringTokenizer ("Test Message"); 147 sbft.setEnumeration(st); 148 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 149 runMyTest("testHiddenPropertyIndexedEnumerationProperty", ""); 150 } 151 152 153 154 } 155
| Popular Tags
|