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 ComponentTest extends AbstractUITagTest { 16 18 21 public void testSimple() throws Exception { 22 TestAction testAction = (TestAction) action; 23 testAction.setFoo("bar"); 24 25 ComponentTag tag = new ComponentTag(); 26 tag.setPageContext(pageContext); 27 tag.setLabel("mylabel"); 28 tag.setName("myname"); 29 tag.setValue("foo"); 30 31 tag.doStartTag(); 32 tag.doEndTag(); 33 34 verify(ComponentTag.class.getResource("Component-1.txt")); 35 } 36 37 41 public void testWithParam() throws Exception { 42 TestAction testAction = (TestAction) action; 43 testAction.setFoo("bar"); 44 45 ComponentTag tag = new ComponentTag(); 46 tag.setPageContext(pageContext); 47 tag.setLabel("mylabel"); 48 tag.setName("myname"); 49 tag.setValue("foo"); 50 tag.setTheme("test"); 51 tag.setTemplate("Component"); 52 53 tag.addParameter("hello", "world"); 54 tag.addParameter("argle", "bargle"); 55 tag.addParameter("glip", "glop"); 56 tag.addParameter("array", new String []{"a", "b", "c"}); 57 tag.addParameter("obj", tag); 58 59 tag.doStartTag(); 60 tag.doEndTag(); 61 62 verify(ComponentTag.class.getResource("Component-param.txt")); 64 } 65 } 66 | Popular Tags |