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

    1   package org.displaytag.jsptests;
    2   
    3   import org.displaytag.decorator.DateColumnDecorator;
    4   import org.displaytag.test.DisplaytagCase;
    5   import org.displaytag.test.KnownTypes;
    6   
    7   import com.meterware.httpunit.GetMethodWebRequest;
    8   import com.meterware.httpunit.WebRequest;
    9   import com.meterware.httpunit.WebResponse;
   10   import com.meterware.httpunit.WebTable;
   11   
   12   
   13   /**
   14    * Tests for column decorators.
   15    * @author Fabrizio Giustina
   16    * @version $Revision: 912 $ ($Author: fgiust $)
   17    */
   18   public class ColumnDecoratorTest extends DisplaytagCase
   19   {
   20   
   21       /**
   22        * @see org.displaytag.test.DisplaytagCase#getJspName()
   23        */
   24       public String getJspName()
   25       {
   26           return "columndecorator.jsp";
   27       }
   28   
   29       /**
   30        * Checks that the generated page contains decorated values.
   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           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           WebTable[] tables = response.getTables();
   46   
   47           assertEquals("Wrong number of tables.", 1, tables.length);
   48   
   49           assertEquals("Expected decorated value not found.", new DateColumnDecorator().decorate(
   50               KnownTypes.TIME_VALUE,
   51               null,
   52               null), tables[0].getCellAsText(1, 0));
   53       }
   54   }

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