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    * Testcase for "excludedParams" table attribute.
   13    * @author Fabrizio Giustina
   14    * @version $Revision: 707 $ ($Author: fgiust $)
   15    */
   16   public class ExcludedParamsTest extends DisplaytagCase
   17   {
   18   
   19       /**
   20        * @see org.displaytag.test.DisplaytagCase#getJspName()
   21        */
   22       public String getJspName()
   23       {
   24           return "excludedparams.jsp";
   25       }
   26   
   27       /**
   28        * Checks generated pagination links.
   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           request.setParameter("foo", "foovalue");
   37           request.setParameter("bar", "barvalue");
   38           request.setParameter("zoo", "zoovalue");
   39   
   40           WebResponse response = runner.getResponse(request);
   41   
   42           if (log.isDebugEnabled())
   43           {
   44               log.debug("RESPONSE: " + response.getText());
   45           }
   46   
   47           WebLink[] links = response.getLinks();
   48   
   49           for (int j = 0; j < links.length; j++)
   50           {
   51               String linkUrl = links[j].getURLString();
   52               assertTrue("Link contains the excluded parameter foo.", linkUrl.indexOf("foo") == -1);
   53               assertTrue("Link contains the excluded parameter bar.", linkUrl.indexOf("bar") == -1);
   54               assertTrue("Link doesn't contains the parameter zoo.", linkUrl.indexOf("zoo") > -1);
   55           }
   56   
   57       }
   58   }

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