1 5 package com.opensymphony.webwork.views.jsp.ui; 6 7 import com.opensymphony.webwork.TestAction; 8 import com.opensymphony.webwork.views.jsp.AbstractUITagTest; 9 10 import java.util.HashMap ; 11 12 13 17 public class RadioTest extends AbstractUITagTest { 18 20 public void testMapChecked() throws Exception { 21 TestAction testAction = (TestAction) action; 22 testAction.setFoo("bar"); 23 24 HashMap map = new HashMap (); 25 map.put("1", "One"); 26 map.put("2", "Two"); 27 testAction.setMap(map); 28 29 RadioTag tag = new RadioTag(); 30 tag.setPageContext(pageContext); 31 tag.setLabel("mylabel"); 32 tag.setName("myname"); 33 tag.setValue("\"1\""); 34 tag.setList("map"); 35 tag.setListKey("key"); 36 tag.setListValue("value"); 37 38 tag.doStartTag(); 39 tag.doEndTag(); 40 41 verify(RadioTag.class.getResource("Radio-2.txt")); 42 } 43 44 public void testSimple() throws Exception { 45 TestAction testAction = (TestAction) action; 46 testAction.setFoo("bar"); 47 testAction.setList(new String [][]{ 48 {"hello", "world"}, 49 {"foo", "bar"} 50 }); 51 52 RadioTag tag = new RadioTag(); 53 tag.setPageContext(pageContext); 54 tag.setLabel("mylabel"); 55 tag.setName("myname"); 56 tag.setValue(""); 57 tag.setList("list"); 58 tag.setListKey("top[0]"); 59 tag.setListValue("top[1]"); 60 61 tag.doStartTag(); 62 tag.doEndTag(); 63 64 verify(RadioTag.class.getResource("Radio-1.txt")); 65 } 66 } 67 | Popular Tags |