KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > views > jsp > ui > RadioTest


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

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 JavaDoc;
11
12
13 /**
14  * @author Matt Ho <a HREF="mailto:matt@enginegreen.com">&lt;matt@enginegreen.com&gt;</a>
15  * @version $Id: RadioTest.java,v 1.15 2005/07/20 14:49:14 plightbo Exp $
16  */

17 public class RadioTest extends AbstractUITagTest {
18     //~ Methods ////////////////////////////////////////////////////////////////
19

20     public void testMapChecked() throws Exception JavaDoc {
21         TestAction testAction = (TestAction) action;
22         testAction.setFoo("bar");
23
24         HashMap JavaDoc map = new HashMap JavaDoc();
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 JavaDoc {
45         TestAction testAction = (TestAction) action;
46         testAction.setFoo("bar");
47         testAction.setList(new String JavaDoc[][]{
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