1 package org.displaytag.jsptests; 2 3 import java.util.HashSet ; 4 import java.util.Set ; 5 6 import org.displaytag.test.DisplaytagCase; 7 8 import com.meterware.httpunit.GetMethodWebRequest; 9 import com.meterware.httpunit.WebLink; 10 import com.meterware.httpunit.WebRequest; 11 import com.meterware.httpunit.WebResponse; 12 13 14 19 public class ExportLinksTest extends DisplaytagCase 20 { 21 22 25 public String getJspName() 26 { 27 return "media.jsp"; 28 } 29 30 35 public void doTest(String jspName) throws Exception 36 { 37 WebRequest request = new GetMethodWebRequest(jspName); 39 WebResponse response = runner.getResponse(request); 40 41 WebLink[] links = response.getLinks(); 42 43 assertEquals("4 links were expected: csv, excel, xml, pdf.", 4, links.length); 44 45 Set linkTexts = new HashSet (); 46 for (int j = 0; j < links.length; j++) 47 { 48 String url = links[j].getURLString(); 49 log.debug(url); 50 if (linkTexts.contains(url)) 51 { 52 fail("Found duplicated link in export banner: " + url); 53 } 54 linkTexts.add(url); 55 } 56 57 } 58 59 } | Popular Tags |