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 11 15 public class LabelTest extends AbstractUITagTest { 16 18 public void testSimple() throws Exception { 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 { 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 { 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 |