1 package info.magnolia.httptest; 2 3 import org.apache.commons.lang.StringUtils; 4 5 import com.meterware.httpunit.GetMethodWebRequest; 6 import com.meterware.httpunit.HTMLElement; 7 import com.meterware.httpunit.WebRequest; 8 import com.meterware.httpunit.WebResponse; 9 10 11 16 public class ButtonTest extends HttpUnitTestCase { 17 18 21 public String getJspName() { 22 return "button.jsp"; 23 } 24 25 28 public void doTest(String jspName) throws Exception { 29 WebRequest request = new GetMethodWebRequest(jspName); 30 WebResponse response = runner.getResponse(request); 31 32 String textContent = response.getText(); 33 34 if (log.isDebugEnabled()) { 35 log.debug(textContent); 36 } 37 38 HTMLElement container = response.getElementWithID("button"); 40 41 assertEquals("Bad or missing button label.", "value", container.getText()); 43 44 assertFalse("nobr tag is not a standard html tag", StringUtils.contains(textContent, "nobr")); 46 assertFalse("If a style is not set, the style attribute should not be written", StringUtils.contains( 47 textContent, 48 "style=\"\"")); 49 assertFalse("nbsp should not be used for padding", StringUtils.contains(textContent, " ")); 50 51 } 52 } 53 | Popular Tags |