KickJava   Java API By Example, From Geeks To Geeks.

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


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.ArrayList JavaDoc;
11 import java.util.Collection JavaDoc;
12
13
14 /**
15  * DOCUMENT ME!
16  *
17  * @author $author$
18  * @version $Revision: 1.9 $
19  */

20 public class CheckboxListTest extends AbstractUITagTest {
21     //~ Methods ////////////////////////////////////////////////////////////////
22

23     public void testMultiple() throws Exception JavaDoc {
24         TestAction testAction = (TestAction) action;
25         Collection JavaDoc collection = new ArrayList JavaDoc(2);
26         collection.add("hello");
27         collection.add("foo");
28         testAction.setCollection(collection);
29         testAction.setList(new String JavaDoc[][]{
30                 {"hello", "world"},
31                 {"foo", "bar"},
32                 {"cat", "dog"}
33         });
34
35         CheckboxListTag tag = new CheckboxListTag();
36         tag.setPageContext(pageContext);
37         tag.setLabel("mylabel");
38         tag.setName("collection");
39         tag.setList("list");
40         tag.setListKey("top[0]");
41         tag.setListValue("top[1]");
42
43         tag.doStartTag();
44         tag.doEndTag();
45
46         verify(CheckboxListTag.class.getResource("CheckboxList-2.txt"));
47     }
48
49     public void testSimple() throws Exception JavaDoc {
50         TestAction testAction = (TestAction) action;
51         testAction.setFoo("hello");
52         testAction.setList(new String JavaDoc[][]{
53                 {"hello", "world"},
54                 {"foo", "bar"}
55         });
56
57         CheckboxListTag tag = new CheckboxListTag();
58         tag.setPageContext(pageContext);
59         tag.setLabel("mylabel");
60         tag.setName("foo");
61         tag.setList("list");
62         tag.setListKey("top[0]");
63         tag.setListValue("top[1]");
64         tag.setOnchange("alert('foo');");
65
66         tag.doStartTag();
67         tag.doEndTag();
68
69         verify(CheckboxListTag.class.getResource("CheckboxList-1.txt"));
70     }
71 }
72
Popular Tags