Home » displaytag-1.1.1-src » org » displaytag » jsptests » [javadoc | source]

    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    * Tests for maxlength attribute.
   13    * @author Fabrizio Giustina
   14    * @version $Revision: 736 $ ($Author: fgiust $)
   15    */
   16   public class MaxLengthTest extends DisplaytagCase
   17   {
   18   
   19       /**
   20        * @see org.displaytag.test.DisplaytagCase#getJspName()
   21        */
   22       public String getJspName()
   23       {
   24           return "maxlength.jsp";
   25       }
   26   
   27       /**
   28        * Test that title is escaped correctly.
   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   
   35           WebRequest request = new GetMethodWebRequest(jspName);
   36   
   37           WebResponse response = runner.getResponse(request);
   38   
   39           WebTable[] tables = response.getTables();
   40           assertEquals("Wrong number of tables.", 1, tables.length);
   41           assertEquals("Wrong number of columns.", 4, tables[0].getColumnCount());
   42   
   43           assertEquals("Broken title.", "123\"567890\"123", tables[0].getTableCell(1, 0).getTitle());
   44   
   45           assertEquals("Wrong content in column 1", "123\"567890...", tables[0].getCellAsText(1, 0));
   46           assertEquals("Wrong content in column 2", "Lorem ipsum dolor...", tables[0].getCellAsText(1, 1));
   47           assertEquals("Wrong content in column 3", "", tables[0].getCellAsText(1, 2));
   48           assertEquals("Wrong content in column 4", "", tables[0].getCellAsText(1, 3));
   49   
   50       }
   51   }

Home » displaytag-1.1.1-src » org » displaytag » jsptests » [javadoc | source]