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 TestCheckboxTag2 extends JspTestCase { 39 40 45 public TestCheckboxTag2(String theName) { 46 super(theName); 47 } 48 49 54 public static void main(String [] theArgs) { 55 junit.awtui.TestRunner.main(new String [] {TestCheckboxTag2.class.getName()}); 56 } 57 58 62 public static Test suite() { 63 return new TestSuite(TestCheckboxTag2.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(true), PageContext.REQUEST_SCOPE); 70 request.setAttribute("runTest", whichTest); 71 pageContext.forward("/test/org/apache/struts/taglib/html/TestCheckboxTag2.jsp"); 72 } 73 74 77 78 public void testCheckboxPropertybooleanTrueStyle() throws Exception { 79 runMyTest("testCheckboxPropertybooleanTrueStyle", ""); 80 } 81 82 public void testCheckboxPropertybooleanTrueStyleClass() throws Exception { 83 runMyTest("testCheckboxPropertybooleanTrueStyleClass", ""); 84 } 85 86 public void testCheckboxPropertybooleanTrueStyleId() throws Exception { 87 runMyTest("testCheckboxPropertybooleanTrueStyleId", ""); 88 } 89 90 public void testCheckboxPropertybooleanTrueTabindex() throws Exception { 91 runMyTest("testCheckboxPropertybooleanTrueTabindex", ""); 92 } 93 94 public void testCheckboxPropertybooleanTrueTitle() throws Exception { 95 runMyTest("testCheckboxPropertybooleanTrueTitle", ""); 96 } 97 98 public void testCheckboxPropertybooleanTrueTitleKey() throws Exception { 99 runMyTest("testCheckboxPropertybooleanTrueTitleKey", ""); 100 } 101 102 public void testCheckboxPropertybooleanTrueTitleKey_fr() throws Exception { 103 runMyTest("testCheckboxPropertybooleanTrueTitleKey_fr", "fr"); 104 } 105 106 public void testCheckboxPropertybooleanTrueValue() throws Exception { 107 runMyTest("testCheckboxPropertybooleanTrueValue", ""); 108 } 109 110 public void testCheckboxPropertybooleanTrueBodyContent() throws Exception { 111 runMyTest("testCheckboxPropertybooleanTrueBodyContent", ""); 112 } 113 114 public void testCheckboxPropertybooleanTrueBodyContentMessageKey() throws Exception { 115 runMyTest("testCheckboxPropertybooleanTrueBodyContentMessageKey", ""); 116 } 117 118 public void testCheckboxPropertybooleanTrueBodyContentMessageKey_fr() throws Exception { 119 runMyTest("testCheckboxPropertybooleanTrueBodyContentMessageKey_fr", "fr"); 120 } 121 122 public void testCheckboxPropertybooleanTrueIndexedArray() throws Exception { 123 ArrayList lst = new ArrayList (); 124 lst.add("Test Message"); 125 pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE); 126 runMyTest("testCheckboxPropertybooleanTrueIndexedArray", ""); 127 } 128 129 public void testCheckboxPropertybooleanTrueIndexedArrayProperty() throws Exception { 130 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 131 ArrayList lst = new ArrayList (); 132 lst.add("Test Message"); 133 sbft.setList(lst); 134 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 135 runMyTest("testCheckboxPropertybooleanTrueIndexedArrayProperty", ""); 136 } 137 138 public void testCheckboxPropertybooleanTrueIndexedMap() throws Exception { 139 HashMap map = new HashMap (); 140 map.put("tst1", "Test Message"); 141 pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE); 142 runMyTest("testCheckboxPropertybooleanTrueIndexedMap", ""); 143 } 144 145 public void testCheckboxPropertybooleanTrueIndexedMapProperty() throws Exception { 146 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 147 HashMap map = new HashMap (); 148 map.put("tst1", "Test Message"); 149 sbft.setMap(map); 150 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 151 runMyTest("testCheckboxPropertybooleanTrueIndexedMapProperty", ""); 152 } 153 154 public void testCheckboxPropertybooleanTrueIndexedEnumeration() throws Exception { 155 StringTokenizer st = new StringTokenizer ("Test Message"); 156 pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE); 157 runMyTest("testCheckboxPropertybooleanTrueIndexedEnumeration", ""); 158 } 159 160 public void testCheckboxPropertybooleanTrueIndexedEnumerationProperty() throws Exception { 161 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 162 StringTokenizer st = new StringTokenizer ("Test Message"); 163 sbft.setEnumeration(st); 164 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 165 runMyTest("testCheckboxPropertybooleanTrueIndexedEnumerationProperty", ""); 166 } 167 168 169 170 } 171 | Popular Tags |