1 18 19 package org.apache.strutsel.taglib.html; 20 21 import java.util.HashMap ; 22 import javax.servlet.ServletException ; 23 import javax.servlet.jsp.JspException ; 24 import junit.framework.Test; 25 import junit.framework.TestSuite; 26 import org.apache.strutsel.taglib.utils.DOMHelper; 27 import org.apache.strutsel.taglib.utils.JspTagTestCase; 28 import org.apache.strutsel.taglib.utils.TestHelper; 29 30 public class TestELHtmlTag 31 extends JspTagTestCase { 32 33 protected ELHtmlTag elHtmlTag = null; 34 35 public TestELHtmlTag(String theName) { 36 super(theName); 37 } 38 39 public static void main(String [] args) { 40 junit.awtui.TestRunner. 41 main(new String [] { TestELHtmlTag.class.getName() }); 42 } 43 44 public static Test suite() { 45 return new TestSuite(TestELHtmlTag.class); 46 } 47 48 public void setUp() { 49 elHtmlTag = new ELHtmlTag(); 50 elHtmlTag.setPageContext(pageContext); 51 } 52 53 public void tearDown() { 54 elHtmlTag = null; 55 } 56 57 public void testPlain() 58 throws ServletException , JspException { 59 60 Boolean bool = new Boolean (true); 61 pageContext.setAttribute("localeFlag", bool); 62 elHtmlTag.setLocaleExpr("true"); 64 elHtmlTag.setXhtmlExpr("true"); 65 66 int startTagReturn = elHtmlTag.doStartTag(); 67 int afterBodyReturn = elHtmlTag.doAfterBody(); 68 int endTagReturn = elHtmlTag.doEndTag(); 69 } 70 71 public void endPlain(com.meterware.httpunit.WebResponse testResponse) { 72 try { 73 TestHelper.printResponse(testResponse); 74 75 org.w3c.dom.Document document = testResponse.getDOM(); 76 DOMHelper.printNode(document.getDocumentElement()); 77 78 HashMap attrMap = new HashMap (); 79 DOMHelper.recordFoundAttributes(testResponse.getDOM(), 80 "/html", attrMap); 81 DOMHelper. 82 verifyAttributesPresent(attrMap, 83 new String [] { "lang", "xml:lang", 84 "xmlns" }, 85 false); 86 } catch (Exception ex) { 87 ex.printStackTrace(); 88 fail(); 89 } 90 } 91 } 92 | Popular Tags |