webwork/src/test/webwork/view/taglib/ui/table WebTableTestCase.java,NONE,1.1

[email protected] Thu, 13 Nov 2003 15:09:12 -0800
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/test/webwork/view/taglib/ui/table
In directory sc8-pr-cvs1:/tmp/cvs-serv11024/src/test/webwork/view/taglib/ui/table

Added Files:
	WebTableTestCase.java 
Log Message:
Added testcase for webtable

--- NEW FILE: WebTableTestCase.java ---
package webwork.view.taglib.ui.table;

import java.io.IOException;

import webwork.view.WebSupport;
import com.meterware.httpunit.*;
import org.xml.sax.SAXException;

/**
 * @author Hani Suleiman ([email protected])
 *         Date: Nov 13
 * @author 2003
 *         Time: 5:43:16 PM
 */
public class WebTableTestCase extends WebSupport
{
  public void testViewTable() throws IOException, SAXException
  {
    WebConversation conversation = new WebConversation();
    WebRequest request = new GetMethodWebRequest(TEST_HOME + "tests/table.action");
    WebResponse response = conversation.getResponse(request);
    com.meterware.httpunit.WebTable table = response.getTableWithID("tabletest");
    assertNotNull("Could not find table with id 'tabletest'", table);
    String[][] contents = table.asText();
    assertEquals("Unexpected number of rows", 4, table.getRowCount());
    assertEquals("unexpected contents for cell [1][1]", "$69.96", contents[1][1].trim());
    assertEquals("unexpected contents for cell [2][0]", "2001-02-02", contents[2][0].trim());
    assertEquals("unexpected contents for cell [2][2]", "default renderer (2)", contents[2][2].trim());
    assertEquals("unexpected contents for cell [3][4]", "weird stuff!", contents[3][4].trim());
  }
}




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/