1 37 package net.sourceforge.cruisecontrol.taglib; 38 39 import javax.servlet.jsp.JspException ; 40 import javax.servlet.jsp.tagext.Tag ; 41 42 import junit.framework.Test; 43 import junit.framework.TestCase; 44 import junit.framework.TestSuite; 45 import net.sourceforge.cruisecontrol.BuildInfoSummary; 46 import net.sourceforge.cruisecontrol.LogFileSetupDecorator; 47 import net.sourceforge.cruisecontrol.mock.MockPageContext; 48 import net.sourceforge.cruisecontrol.mock.MockServletConfig; 49 50 55 public class BuildInfoTagTest extends TestCase { 56 private MockPageContext pageContext; 57 private BuildInfoTag tag; 58 59 public static Test suite() { 60 return new LogFileSetupDecorator(new TestSuite(BuildInfoTagTest.class)); 61 } 62 63 protected void setUp() { 64 pageContext = new MockPageContext(); 65 tag = new BuildInfoTag(); 66 tag.setPageContext(pageContext); 67 68 final MockServletConfig servletConfig = (MockServletConfig) pageContext.getServletConfig(); 69 servletConfig.setInitParameter("logDir", LogFileSetupDecorator.LOG_DIR.getAbsolutePath()); 70 } 71 72 protected void tearDown() { 73 tag.release(); 74 } 75 76 77 public void testTagCreatesBuildInfo() throws JspException { 78 assertEquals(Tag.SKIP_BODY, tag.doStartTag()); 79 assertEquals(Tag.EVAL_PAGE, tag.doEndTag()); 80 BuildInfoSummary buildInfoSummary = (BuildInfoSummary) pageContext.getAttribute(BuildInfoTag.INFO_ATTRIBUTE); 81 assertNotNull(buildInfoSummary); 82 assertEquals(6, buildInfoSummary.size()); 83 } 84 } 85 | Popular Tags |