1 16 package org.apache.myfaces.taglib.html; 17 18 import com.meterware.httpunit.WebForm; 19 import com.meterware.httpunit.WebResponse; 20 import org.w3c.dom.Node ; 21 import org.w3c.dom.NodeList ; 22 23 import org.apache.cactus.ServletTestCase; 24 25 import javax.servlet.RequestDispatcher ; 26 27 35 public class DivTagCactusTest 36 extends ServletTestCase 37 { 38 39 public DivTagCactusTest(String name) { 40 super(name); 41 } 42 43 public void testSimpleRender() throws Exception { 44 RequestDispatcher rd = config.getServletContext().getRequestDispatcher( 45 "/DivTagCactusTest.jsf"); 46 rd.forward(request, response); 48 } 49 50 public void endSimpleRender(WebResponse response) 51 throws Exception 52 { 53 WebForm form = response.getFormWithID("testForm"); 54 Node node = form.getDOMSubtree(); 55 NodeList lst = node.getChildNodes(); 56 assertTrue(2 <= lst.getLength()); 57 Node div = lst.item(0); 58 assertEquals("bar", div.getAttributes().getNamedItem("style").getNodeValue()); 59 div = lst.item(1); 60 assertEquals("foo", div.getAttributes().getNamedItem("class").getNodeValue()); 61 } 62 } 63 | Popular Tags |