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.TableCell;
    7   import com.meterware.httpunit.WebRequest;
    8   import com.meterware.httpunit.WebResponse;
    9   import com.meterware.httpunit.WebTable;
   10   
   11   
   12   /**
   13    * Tests for DISPL-49 - style of column cannot be dynamically changed
   14    * @author Fabrizio Giustina
   15    * @version $Id$
   16    */
   17   public class Displ049Test extends DisplaytagCase
   18   {
   19   
   20       /**
   21        * @see org.displaytag.test.DisplaytagCase#getJspName()
   22        */
   23       public String getJspName()
   24       {
   25           return "DISPL-049.jsp";
   26       }
   27   
   28       /**
   29        * Check variable style and class 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           WebResponse response = runner.getResponse(request);
   37   
   38           if (log.isDebugEnabled())
   39           {
   40               log.debug(response.getText());
   41           }
   42   
   43           WebTable[] tables = response.getTables();
   44           assertEquals("Wrong number of tables in result.", 1, tables.length);
   45           assertEquals("Wrong number of rows in result.", 3, tables[0].getRowCount());
   46   
   47           if (log.isDebugEnabled())
   48           {
   49               log.debug(response.getText());
   50           }
   51   
   52           TableCell row1Cell = tables[0].getTableCell(1, 0);
   53           assertEquals("Wrong style attribute.", "style-1", row1Cell.getAttribute("style"));
   54           assertEquals("Wrong class attribute.", "class-1", row1Cell.getClassName());
   55   
   56           TableCell row2Cell = tables[0].getTableCell(2, 0);
   57           assertEquals("Wrong style attribute.", "style-2", row2Cell.getAttribute("style"));
   58           assertEquals("Wrong class attribute.", "class-2", row2Cell.getClassName());
   59       }
   60   }

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