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.TableRow;
    7   import com.meterware.httpunit.WebRequest;
    8   import com.meterware.httpunit.WebResponse;
    9   import com.meterware.httpunit.WebTable;
   10   
   11   
   12   /**
   13    * Test for DISPL-110 - Ability to highlight selected table row
   14    * @author Fabrizio Giustina
   15    * @version $Id$
   16    */
   17   public class Displ110Test extends DisplaytagCase
   18   {
   19   
   20       /**
   21        * @see org.displaytag.test.DisplaytagCase#getJspName()
   22        */
   23       public String getJspName()
   24       {
   25           return "DISPL-110.jsp";
   26       }
   27   
   28       /**
   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           if (log.isDebugEnabled())
   40           {
   41               log.debug(response.getText());
   42           }
   43   
   44           WebTable[] tables = response.getTables();
   45           assertEquals("Wrong number of tables.", 1, tables.length);
   46   
   47           assertEquals("Wrong number of columns.", 2, tables[0].getColumnCount());
   48           assertEquals("Wrong number of rows.", 3, tables[0].getRowCount()); // 2 plus header
   49   
   50           TableRow[] rows = tables[0].getRows();
   51   
   52           assertEquals("Wrong id for row 1", "idcamel0", rows[1].getID());
   53           assertEquals("Wrong id for row 2", "idcamel1", rows[2].getID());
   54   
   55           assertEquals("Wrong class for row 1", "odd classcamel0", rows[1].getClassName());
   56           assertEquals("Wrong class for row 2", "even classcamel1", rows[2].getClassName());
   57   
   58       }
   59   }

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