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