KickJava   Java API By Example, From Geeks To Geeks.

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


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

15 public class LabelTest extends AbstractUITagTest {
16     //~ Methods ////////////////////////////////////////////////////////////////
17

18     public void testSimple() throws Exception JavaDoc {
19         TestAction testAction = (TestAction) action;
20         testAction.setFoo("bar");
21
22         LabelTag tag = new LabelTag();
23         tag.setPageContext(pageContext);
24         tag.setLabel("mylabel");
25         tag.setName("myname");
26         tag.setValue("%{foo}");
27
28         tag.doStartTag();
29         tag.doEndTag();
30
31         verify(LabelTest.class.getResource("Label-1.txt"));
32     }
33
34     public void testSimpleWithLabelposition() throws Exception JavaDoc {
35         TestAction testAction = (TestAction) action;
36         testAction.setFoo("bar");
37
38         LabelTag tag = new LabelTag();
39         tag.setPageContext(pageContext);
40         tag.setLabel("mylabel");
41         tag.setName("myname");
42         tag.setValue("%{foo}");
43         tag.setLabelposition("top");
44
45         tag.doStartTag();
46         tag.doEndTag();
47
48         verify(LabelTest.class.getResource("Label-3.txt"));
49     }
50
51     public void testWithNoValue() throws Exception JavaDoc {
52         TestAction testAction = (TestAction) action;
53         testAction.setFoo("baz");
54
55         LabelTag tag = new LabelTag();
56         tag.setPageContext(pageContext);
57         tag.setLabel("mylabel");
58         tag.setName("foo");
59         tag.setFor("for");
60
61         tag.doStartTag();
62         tag.doEndTag();
63
64         verify(LabelTest.class.getResource("Label-2.txt"));
65     }
66 }
67
Popular Tags