FileDocCategorySizeDatePackage
HeadTagTest.javaAPI DocExample3612Mon Jul 23 13:26:16 BST 2007org.apache.struts2.views.jsp.ui

HeadTagTest

public class HeadTagTest extends org.apache.struts2.views.jsp.AbstractUITagTest
Unit test for {@link HeadTag}.

Note: If unit test fails with encoding difference check the src/test/struts.properties and adjust the .txt files accordingly

Fields Summary
private HeadTag
tag
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        tag = new HeadTag();
        tag.setPageContext(pageContext);
    
protected voidtearDown()

        super.tearDown();
    
public voidtestHead1()

        tag.doStartTag();
        tag.doEndTag();

        verify(HeadTagTest.class.getResource("HeadTagTest-1.txt"));
    
public voidtestHead1NoCalender()

        tag.doStartTag();
        tag.doEndTag();
        tag.setCalendarcss(null); // null = should use calendar-blue.css

        verify(HeadTagTest.class.getResource("HeadTagTest-1.txt"));
    
public voidtestHead2()

        tag.setTheme("ajax");
        tag.doStartTag();
        Head component = (Head) tag.getComponent();
        assertTrue(!component.isDebug());
        tag.doEndTag();

        verify(HeadTagTest.class.getResource("HeadTagTest-2.txt"));
        assertTrue("should have debug false", writer.toString().indexOf("isDebug: false") > -1);
    
public voidtestHead3()

        tag.setTheme("ajax");
        tag.setDebug("true");
        tag.doStartTag();
        Head component = (Head) tag.getComponent(); // must be done between start and end
        assertTrue(component.isDebug());
        tag.doEndTag();

        verify(HeadTagTest.class.getResource("HeadTagTest-3.txt"));
        assertTrue("should have debug true", writer.toString().indexOf("isDebug: true") > -1);
    
public voidtestHead4()

        tag.setCalendarcss("my-calendar");
        tag.doStartTag();
        tag.doEndTag();

        verify(HeadTagTest.class.getResource("HeadTagTest-4.txt"));
        assertEquals("my-calendar", tag.getCalendarcss());
    
public voidtestHead4b()

        tag.setCalendarcss("my-calendar.css");
        tag.doStartTag();
        Head component = (Head) tag.getComponent(); // must be done between start and end
        assertEquals("my-calendar.css", component.getCalendarcss());
        tag.doEndTag();

        verify(HeadTagTest.class.getResource("HeadTagTest-4.txt"));
        assertEquals("my-calendar.css", tag.getCalendarcss());