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

    1   package org.displaytag.jsptests;
    2   
    3   import org.apache.commons.lang.StringUtils;
    4   import org.displaytag.test.DisplaytagCase;
    5   
    6   import com.meterware.httpunit.GetMethodWebRequest;
    7   import com.meterware.httpunit.WebLink;
    8   import com.meterware.httpunit.WebRequest;
    9   import com.meterware.httpunit.WebResponse;
   10   
   11   
   12   /**
   13    * Basic tests for pagination.
   14    * @author Fabrizio Giustina
   15    * @version $Revision: 707 $ ($Author: fgiust $)
   16    */
   17   public class PaginationAllItemsTest extends DisplaytagCase
   18   {
   19   
   20       /**
   21        * @see org.displaytag.test.DisplaytagCase#getJspName()
   22        */
   23       public String getJspName()
   24       {
   25           return "pagination-all-items.jsp";
   26       }
   27   
   28       /**
   29        * Just a quick test to assure that you can avoid page numbers when displaying one page.
   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   
   38           WebResponse response = runner.getResponse(request);
   39   
   40           if (log.isDebugEnabled())
   41           {
   42               log.debug("RESPONSE: " + response.getText());
   43           }
   44   
   45           WebLink[] links = response.getLinks();
   46   
   47           assertEquals("Wrong number of links in result.", 0, links.length);
   48           assertFalse("Using setProperty you should not see any page number", StringUtils.contains(
   49               response.getText(),
   50               ">1<"));
   51   
   52       }
   53   }

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