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 TestRadioTag2 extends JspTestCase { 39 40 45 public TestRadioTag2(String theName) { 46 super(theName); 47 } 48 49 54 public static void main(String [] theArgs) { 55 junit.awtui.TestRunner.main(new String [] {TestRadioTag2.class.getName()}); 56 } 57 58 62 public static Test suite() { 63 return new TestSuite(TestRadioTag2.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/TestRadioTag2.jsp"); 72 } 73 74 77 78 public void testRadioPropertyStyle() throws Exception { 79 runMyTest("testRadioPropertyStyle", ""); 80 } 81 public void testRadioPropertyErrorStyle() throws Exception { 82 runMyTest("testRadioPropertyErrorStyle", ""); 83 } 84 public void testRadioPropertyStyleClass() throws Exception { 85 runMyTest("testRadioPropertyStyleClass", ""); 86 } 87 public void testRadioPropertyErrorStyleClass() throws Exception { 88 runMyTest("testRadioPropertyErrorStyleClass", ""); 89 } 90 public void testRadioPropertyStyleId() throws Exception { 91 runMyTest("testRadioPropertyStyleId", ""); 92 } 93 public void testRadioPropertyErrorStyleId() throws Exception { 94 runMyTest("testRadioPropertyErrorStyleId", ""); 95 } 96 public void testRadioPropertyTitle() throws Exception { 97 runMyTest("testRadioPropertyTitle", ""); 98 } 99 public void testRadioPropertyTitleKey() throws Exception { 100 runMyTest("testRadioPropertyTitleKey", ""); 101 } 102 public void testRadioPropertyTitleKey_fr() throws Exception { 103 runMyTest("testRadioPropertyTitleKey_fr", "fr"); 104 } 105 public void testRadioPropertyValueMatch() throws Exception { 106 runMyTest("testRadioPropertyValueMatch", ""); 107 } 108 public void testRadioPropertyValueNotMatch() throws Exception { 109 runMyTest("testRadioPropertyValueNotMatch", ""); 110 } 111 public void testRadioPropertyIndexedArray() throws Exception { 112 ArrayList lst = new ArrayList (); 113 lst.add("Test Message"); 114 pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE); 115 runMyTest("testRadioPropertyIndexedArray", ""); 116 } 117 public void testRadioPropertyIndexedArrayProperty() throws Exception { 118 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 119 ArrayList lst = new ArrayList (); 120 lst.add("Test Message"); 121 sbft.setList(lst); 122 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 123 runMyTest("testRadioPropertyIndexedArrayProperty", ""); 124 } 125 public void testRadioPropertyIndexedMap() throws Exception { 126 HashMap map = new HashMap (); 127 map.put("tst1", "Test Message"); 128 pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE); 129 runMyTest("testRadioPropertyIndexedMap", ""); 130 } 131 public void testRadioPropertyIndexedMapProperty() throws Exception { 132 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 133 HashMap map = new HashMap (); 134 map.put("tst1", "Test Message"); 135 sbft.setMap(map); 136 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 137 runMyTest("testRadioPropertyIndexedMapProperty", ""); 138 } 139 public void testRadioPropertyIndexedEnumeration() throws Exception { 140 StringTokenizer st = new StringTokenizer ("Test Message"); 141 pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE); 142 runMyTest("testRadioPropertyIndexedEnumeration", ""); 143 } 144 public void testRadioPropertyIndexedEnumerationProperty() 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("testRadioPropertyIndexedEnumerationProperty", ""); 150 } 151 152 } 153 | Popular Tags |