FileDocCategorySizeDatePackage
SetTagTest.javaAPI DocExample3414Mon Jul 23 13:26:16 BST 2007org.apache.struts2.views.jsp

SetTagTest

public class SetTagTest extends AbstractUITagTest

Fields Summary
Chewbacca
chewie
SetTag
tag
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();

        tag = new SetTag();
        chewie = new Chewbacca("chewie", true);
        stack.push(chewie);
        tag.setPageContext(pageContext);
    
public voidtestApplicationScope()

        tag.setName("foo");
        tag.setValue("name");
        tag.setScope("application");
        tag.doStartTag();
        tag.doEndTag();

        assertEquals("chewie", servletContext.getAttribute("foo"));
    
public voidtestPageScope()

        tag.setName("foo");
        tag.setValue("name");
        tag.setScope("page");
        tag.doStartTag();
        tag.doEndTag();

        assertEquals("chewie", pageContext.getAttribute("foo"));
    
public voidtestRequestScope()

        tag.setName("foo");
        tag.setValue("name");
        tag.setScope("request");
        tag.doStartTag();
        tag.doEndTag();
        assertEquals("chewie", request.getAttribute("foo"));
    
public voidtestSessionScope()

        tag.setName("foo");
        tag.setValue("name");
        tag.setScope("session");
        tag.doStartTag();
        tag.doEndTag();

        assertEquals("chewie", session.get("foo"));
    
public voidtestStrutsScope()

        tag.setName("foo");
        tag.setValue("name");
        tag.doStartTag();
        tag.doEndTag();
        assertEquals("chewie", context.get("foo"));
    
public voidtestStrutsScope2()

        tag.setName("chewie");
        tag.doStartTag();
        tag.doEndTag();
        assertEquals(chewie, context.get("chewie"));