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 DISPL-18 - Setting own comparator for column sorting.
   13    * @author rapruitt
   14    * @version $Revision: 876 $ ($Author: fgiust $)
   15    */
   16   public class Displ018Test extends DisplaytagCase
   17   {
   18   
   19       /**
   20        * @see org.displaytag.test.DisplaytagCase#getJspName()
   21        */
   22       public String getJspName()
   23       {
   24           return "DISPL-018.jsp";
   25       }
   26   
   27       /**
   28        * Check sorted columns.
   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           WebResponse response = runner.getResponse(request);
   36   
   37           if (log.isDebugEnabled())
   38           {
   39               log.debug(response.getText());
   40           }
   41   
   42           WebTable[] tables = response.getTables();
   43           assertEquals("Wrong number of tables.", 4, tables.length);
   44   
   45           for (int j = 0; j < tables.length; j++)
   46           {
   47               WebTable table = tables[j];
   48               assertEquals("Wrong number of columns in table." + j, 2, table.getColumnCount());
   49               assertEquals("Wrong number of rows in table." + j, 5, table.getRowCount());
   50   
   51               for (int u = 1; u < 5; u++)
   52               {
   53                   assertEquals("Wrong value in table cell.", Integer.toString(u), table.getCellAsText(u, 1));
   54               }
   55           }
   56   
   57       }
   58   
   59   }

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