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 Displ049Test extends DisplaytagCase 18 { 19 20 23 public String getJspName() 24 { 25 return "DISPL-049.jsp"; 26 } 27 28 33 public void doTest(String jspName) throws Exception 34 { 35 WebRequest request = new GetMethodWebRequest(jspName); 36 WebResponse response = runner.getResponse(request); 37 38 if (log.isDebugEnabled()) 39 { 40 log.debug(response.getText()); 41 } 42 43 WebTable[] tables = response.getTables(); 44 assertEquals("Wrong number of tables in result.", 1, tables.length); 45 assertEquals("Wrong number of rows in result.", 3, tables[0].getRowCount()); 46 47 if (log.isDebugEnabled()) 48 { 49 log.debug(response.getText()); 50 } 51 52 TableCell row1Cell = tables[0].getTableCell(1, 0); 53 assertEquals("Wrong style attribute.", "style-1", row1Cell.getAttribute("style")); 54 assertEquals("Wrong class attribute.", "class-1", row1Cell.getClassName()); 55 56 TableCell row2Cell = tables[0].getTableCell(2, 0); 57 assertEquals("Wrong style attribute.", "style-2", row2Cell.getAttribute("style")); 58 assertEquals("Wrong class attribute.", "class-2", row2Cell.getClassName()); 59 } 60 } | Popular Tags |