1 package org.displaytag.jsptests; 2 3 import org.displaytag.test.DisplaytagCase; 4 5 import com.meterware.httpunit.GetMethodWebRequest; 6 import com.meterware.httpunit.TableCell; 7 import com.meterware.httpunit.WebRequest; 8 import com.meterware.httpunit.WebResponse; 9 import com.meterware.httpunit.WebTable; 10 11 12 17 public class HtmlAttributesTest extends DisplaytagCase 18 { 19 20 23 public String getJspName() 24 { 25 return "htmlattributes.jsp"; 26 } 27 28 33 public void doTest(String jspName) throws Exception 34 { 35 WebRequest request = new GetMethodWebRequest(jspName); 36 WebResponse response; 37 38 response = runner.getResponse(request); 39 40 WebTable[] tables = response.getTables(); 41 assertEquals("Wrong number of tables.", 1, tables.length); 42 WebTable table = tables[0]; 43 44 assertEquals("invalid id", "idX", table.getID()); 45 46 assertEquals("invalid attribute value", "cellspacingX", table.getAttribute("cellspacing")); 47 assertEquals("invalid attribute value", "cellpaddingX", table.getAttribute("cellpadding")); 48 assertEquals("invalid attribute value", "frameX", table.getAttribute("frame")); 49 assertEquals("invalid attribute value", "rulesX", table.getAttribute("rules")); 50 assertEquals("invalid attribute value", "styleX", table.getAttribute("style")); 51 assertEquals("invalid attribute value", "summaryX", table.getAttribute("summary")); 52 assertEquals("invalid attribute value", "classX", table.getAttribute("class")); 53 54 TableCell cell = table.getTableCell(1, 0); 55 assertEquals("invalid attribute value", "styleX", cell.getAttribute("style")); 56 assertEquals("invalid attribute value", "classX", cell.getAttribute("class")); 57 58 } 59 } | Popular Tags |