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.WebLink;
    7   import com.meterware.httpunit.WebRequest;
    8   import com.meterware.httpunit.WebResponse;
    9   
   10   
   11   /**
   12    * Basic tests for pagination.
   13    * @author Fabrizio Giustina
   14    * @version $Revision: 707 $ ($Author: fgiust $)
   15    */
   16   public class PaginationTest extends DisplaytagCase
   17   {
   18   
   19       /**
   20        * @see org.displaytag.test.DisplaytagCase#getJspName()
   21        */
   22       public String getJspName()
   23       {
   24           return "pagination.jsp";
   25       }
   26   
   27       /**
   28        * Verifies that the generated page contains the pagination links with the inupt parameter. Tests #917200 ("{}" in
   29        * parameters).
   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           request.setParameter("{foo}", "/.,;:/||\\bar");
   38   
   39           WebResponse response = runner.getResponse(request);
   40   
   41           if (log.isDebugEnabled())
   42           {
   43               log.debug("RESPONSE: " + response.getText());
   44           }
   45   
   46           WebLink[] links = response.getLinks();
   47   
   48           assertEquals("Wrong number of links in result.", 4, links.length);
   49   
   50           for (int j = 0; j < links.length; j++)
   51           {
   52               assertTrue(links[j].getURLString().indexOf("{foo}=%2F.%2C%3B%3A%2F%7C%7C%5Cbar") > -1);
   53               if (log.isDebugEnabled())
   54               {
   55                   log.debug(j + " " + links[j].getURLString());
   56               }
   57           }
   58   
   59       }
   60   }

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