1 package org.displaytag.jsptests; 2 3 import org.displaytag.test.DisplaytagCase; 4 5 import com.meterware.httpunit.GetMethodWebRequest; 6 import com.meterware.httpunit.WebLink; 7 import com.meterware.httpunit.WebRequest; 8 import com.meterware.httpunit.WebResponse; 9 import com.meterware.httpunit.WebTable; 10 11 12 17 public class ColumnLinksTest extends DisplaytagCase 18 { 19 20 23 public String getJspName() 24 { 25 return "columnlinks.jsp"; 26 } 27 28 33 public void doTest(String jspName) throws Exception 34 { 35 WebRequest request = new GetMethodWebRequest(jspName); 36 37 WebResponse response = runner.getResponse(request); 38 if (log.isDebugEnabled()) 39 { 40 log.debug(response.getText()); 41 } 42 43 WebTable[] tables = response.getTables(); 44 assertEquals("Wrong number of tables.", 1, tables.length); 45 46 WebLink[] links = response.getLinks(); 47 assertEquals("Wrong number of links in result.", 6, links.length); 48 49 assertEquals("Text in first link is wrong.", "/context/dynlink?param=ant", links[0].getURLString()); 50 assertEquals("Text in second link is wrong.", "/context/dynlink?param=ant", links[1].getURLString()); 51 assertEquals("Text in third link is wrong.", "dynlink?param=ant", links[2].getURLString()); 52 assertEquals("Text in fourth link is wrong.", "http://something/dynlink?param=ant", links[3].getURLString()); 53 assertEquals("Text in fifth link is wrong.", "http://something/dynlink", links[4].getURLString()); 54 assertEquals("Text in sixth link is wrong.", "/context/dynlink", links[5].getURLString()); 55 } 56 57 } | Popular Tags |