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    * Test for DISPL-085 - Dynamic Column Creation
   13    * @author Fabrizio Giustina
   14    * @version $Id$
   15    */
   16   public class Displ085Test extends DisplaytagCase
   17   {
   18   
   19       /**
   20        * @see org.displaytag.test.DisplaytagCase#getJspName()
   21        */
   22       public String getJspName()
   23       {
   24           return "DISPL-085.jsp";
   25       }
   26   
   27       /**
   28        * A simple way for creating columns on the fly using jstl.
   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   
   49           assertEquals("Wrong title.", "ant title", tables[0].getCellAsText(0, 0));
   50           assertEquals("Wrong title.", "bee title", tables[0].getCellAsText(0, 1));
   51   
   52           assertEquals("Wrong content.", "ant", tables[0].getCellAsText(1, 0));
   53           assertEquals("Wrong content.", "bee", tables[0].getCellAsText(1, 1));
   54   
   55           // only one sortable column
   56           assertEquals("Wrong number of links.", 1, response.getLinks().length);
   57   
   58       }
   59   
   60   }

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