1 package org.displaytag.jsptests; 2 3 import org.displaytag.test.DisplaytagCase; 4 5 import com.meterware.httpunit.GetMethodWebRequest; 6 import com.meterware.httpunit.WebRequest; 7 import com.meterware.httpunit.WebResponse; 8 import com.meterware.httpunit.WebTable; 9 10 11 /** 12 * Test for DISPL-234 - HTML title not added with chopped value (column tag - maxLength attribute). 13 * @author Fabrizio Giustina 14 * @version $Revision$ ($Author$) 15 */ 16 public class Displ234Test extends DisplaytagCase 17 { 18 19 /** 20 * @see org.displaytag.test.DisplaytagCase#getJspName() 21 */ 22 public String getJspName() 23 { 24 return "DISPL-234.jsp"; 25 } 26 27 /** 28 * Title should be added to td. 29 * @param jspName jsp name, with full path 30 * @throws Exception any axception thrown during test. 31 */ 32 public void doTest(String jspName) throws Exception 33 { 34 WebRequest request = new GetMethodWebRequest(jspName); 35 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.", 2, tables[0].getRowCount()); 46 47 assertEquals("Wrong or missing title for cropped text.", "123456789012", tables[0] 48 .getTableCell(1, 0) 49 .getAttribute("title")); 50 assertEquals("Wrong or missing title for cropped text.", "12345678901234", tables[0] 51 .getTableCell(1, 1) 52 .getAttribute("title")); 53 assertEquals("Wrong or missing title for cropped text.", "12345678901234567", tables[0] 54 .getTableCell(1, 2) 55 .getAttribute("title")); 56 assertEquals("Title should not be added.", "", tables[0].getTableCell(1, 3).getAttribute("title")); 57 58 } 59 60 }