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.TableCell;
    8   import com.meterware.httpunit.WebRequest;
    9   import com.meterware.httpunit.WebResponse;
   10   import com.meterware.httpunit.WebTable;
   11   
   12   
   13   /**
   14    * Tests for SetProperty tag.
   15    * @author Fabrizio Giustina
   16    * @version $Revision: 707 $ ($Author: fgiust $)
   17    */
   18   public class CssPropertyTest extends DisplaytagCase
   19   {
   20   
   21       /**
   22        * @see org.displaytag.test.DisplaytagCase#getJspName()
   23        */
   24       public String getJspName()
   25       {
   26           return "cssproperty.jsp";
   27       }
   28   
   29       /**
   30        * Check that css classes are set correctly according to the ones in setProperty tags.
   31        * @param jspName jsp name, with full path
   32        * @throws Exception any axception thrown during test.
   33        */
   34       public void doTest(String jspName) throws Exception
   35       {
   36   
   37           WebRequest request = new GetMethodWebRequest(jspName);
   38   
   39           WebResponse response = runner.getResponse(request);
   40   
   41           if (log.isDebugEnabled())
   42           {
   43               log.debug("RESPONSE: " + response.getText());
   44           }
   45   
   46           WebTable[] tables = response.getTables();
   47   
   48           assertEquals("Expected 1 table in result.", 1, tables.length);
   49           TableCell cell = tables[0].getTableCell(0, 0);
   50           assertTrue("Expected css class \"green\" not found", StringUtils.contains(cell.getClassName(), "green"));
   51           assertTrue("Expected css class \"purple\" not found", StringUtils.contains(cell.getClassName(), "purple"));
   52       }
   53   }

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