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   import com.meterware.httpunit.WebTable;
   10   
   11   
   12   /**
   13    * Tests for 1016089 - Param values not URLEncoded.
   14    * @author Fabrizio Giustina
   15    * @version $Revision: 894 $ ($Author: fgiust $)
   16    */
   17   public class EncodedParametersTest extends DisplaytagCase
   18   {
   19   
   20       /**
   21        * @see org.displaytag.test.DisplaytagCase#getJspName()
   22        */
   23       public String getJspName()
   24       {
   25           return "encodedparameter.jsp";
   26       }
   27   
   28       /**
   29        * Test link generated using column attributes.
   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           WebRequest request = new GetMethodWebRequest(jspName);
   36   
   37           WebResponse response = runner.getResponse(request);
   38           if (log.isDebugEnabled())
   39           {
   40               log.debug(response.getText());
   41           }
   42   
   43           WebTable[] tables = response.getTables();
   44           assertEquals("Wrong number of tables.", 1, tables.length);
   45   
   46           WebLink[] links = response.getLinks();
   47           assertEquals("Wrong number of links in result.", 1, links.length);
   48   
   49           assertEquals("Parameter in link should be encoded.", "/context/dynlink?param=1%2B1", links[0].getURLString());
   50       }
   51   
   52   }

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