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

    1   package org.displaytag.jsptests;
    2   
    3   import org.apache.commons.lang.StringUtils;
    4   import org.displaytag.test.DisplaytagCase;
    5   
    6   import com.meterware.httpunit.GetMethodWebRequest;
    7   import com.meterware.httpunit.WebRequest;
    8   import com.meterware.httpunit.WebResponse;
    9   import com.meterware.httpunit.WebTable;
   10   
   11   
   12   /**
   13    * Tests for DISPL-224 - Adding the "scope" attribute to table header cells for web accessibility.
   14    * @author Fabrizio Giustina
   15    * @version $Revision: 869 $ ($Author: fgiust $)
   16    */
   17   public class Displ224Test extends DisplaytagCase
   18   {
   19   
   20       /**
   21        * @see org.displaytag.test.DisplaytagCase#getJspName()
   22        */
   23       public String getJspName()
   24       {
   25           return "DISPL-224.jsp";
   26       }
   27   
   28       /**
   29        * Check the content of the title attribute.
   30        * @param jspName jsp name, with full path
   31        * @throws Exception any axception thrown during test.
   32        */
   33       public void doTest(String jspName) throws Exception
   34       {
   35   
   36           WebRequest request = new GetMethodWebRequest(jspName);
   37           WebResponse response = runner.getResponse(request);
   38   
   39           WebTable[] tables = response.getTables();
   40           assertEquals("Wrong number of tables in result.", 1, tables.length);
   41   
   42           assertEquals("Wrong number of rows in result.", 2, tables[0].getRowCount());
   43           assertEquals("col", tables[0].getTableCell(0, 0).getAttribute("scope"));
   44           assertEquals(StringUtils.EMPTY, tables[0].getTableCell(0, 1).getAttribute("scope"));
   45           assertEquals(StringUtils.EMPTY, tables[0].getTableCell(1, 0).getAttribute("scope"));
   46           assertEquals("row", tables[0].getTableCell(1, 1).getAttribute("scope"));
   47   
   48       }
   49   
   50   }

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