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 TestTextareaTag2 extends JspTestCase { 39 40 45 public TestTextareaTag2(String theName) { 46 super(theName); 47 } 48 49 54 public static void main(String [] theArgs) { 55 junit.awtui.TestRunner.main(new String [] {TestTextareaTag2.class.getName()}); 56 } 57 58 62 public static Test suite() { 63 return new TestSuite(TestTextareaTag2.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/TestTextareaTag2.jsp"); 72 } 73 74 77 78 public void testTextareaPropertyReadonly() throws Exception { 79 runMyTest("testTextareaPropertyReadonly", ""); 80 } 81 public void testTextareaPropertyRows() throws Exception { 82 runMyTest("testTextareaPropertyRows", ""); 83 } 84 public void testTextareaPropertyStyle() throws Exception { 85 runMyTest("testTextareaPropertyStyle", ""); 86 } 87 public void testTextareaPropertyErrorStyle() throws Exception { 88 runMyTest("testTextareaPropertyErrorStyle", ""); 89 } 90 public void testTextareaPropertyStyleClass() throws Exception { 91 runMyTest("testTextareaPropertyStyleClass", ""); 92 } 93 public void testTextareaPropertyErrorStyleClass() throws Exception { 94 runMyTest("testTextareaPropertyErrorStyleClass", ""); 95 } 96 public void testTextareaPropertyStyleId() throws Exception { 97 runMyTest("testTextareaPropertyStyleId", ""); 98 } 99 public void testTextareaPropertyErrorStyleId() throws Exception { 100 runMyTest("testTextareaPropertyErrorStyleId", ""); 101 } 102 public void testTextareaPropertyTitle() throws Exception { 103 runMyTest("testTextareaPropertyTitle", ""); 104 } 105 public void testTextareaPropertyTitleKey() throws Exception { 106 runMyTest("testTextareaPropertyTitleKey", ""); 107 } 108 public void testTextareaPropertyTitleKey_fr() throws Exception { 109 runMyTest("testTextareaPropertyTitleKey_fr", "fr"); 110 } 111 public void testTextareaPropertyValue() throws Exception { 112 runMyTest("testTextareaPropertyValue", ""); 113 } 114 public void testTextareaPropertyIndexedArray() throws Exception { 115 ArrayList lst = new ArrayList (); 116 lst.add("Test Message"); 117 pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE); 118 runMyTest("testTextareaPropertyIndexedArray", ""); 119 } 120 public void testTextareaPropertyIndexedArrayProperty() throws Exception { 121 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 122 ArrayList lst = new ArrayList (); 123 lst.add("Test Message"); 124 sbft.setList(lst); 125 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 126 runMyTest("testTextareaPropertyIndexedArrayProperty", ""); 127 } 128 public void testTextareaPropertyIndexedMap() throws Exception { 129 HashMap map = new HashMap (); 130 map.put("tst1", "Test Message"); 131 pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE); 132 runMyTest("testTextareaPropertyIndexedMap", ""); 133 } 134 public void testTextareaPropertyIndexedMapProperty() throws Exception { 135 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 136 HashMap map = new HashMap (); 137 map.put("tst1", "Test Message"); 138 sbft.setMap(map); 139 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 140 runMyTest("testTextareaPropertyIndexedMapProperty", ""); 141 } 142 public void testTextareaPropertyIndexedEnumeration() throws Exception { 143 StringTokenizer st = new StringTokenizer ("Test Message"); 144 pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE); 145 runMyTest("testTextareaPropertyIndexedEnumeration", ""); 146 } 147 public void testTextareaPropertyIndexedEnumerationProperty() throws Exception { 148 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 149 StringTokenizer st = new StringTokenizer ("Test Message"); 150 sbft.setEnumeration(st); 151 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 152 runMyTest("testTextareaPropertyIndexedEnumerationProperty", ""); 153 } 154 155 } 156 | Popular Tags |