1 5 package org.exoplatform.test.web.validator; 6 7 import org.exoplatform.test.web.ExoWebClient; 8 import com.meterware.httpunit.*; 9 15 public class ExpectTextValidator implements Validator { 16 private String expectText_ ; 17 public ExpectTextValidator(String text) { 18 expectText_ = text ; 19 } 20 21 public boolean validate(WebResponse response, ExoWebClient client) throws Exception { 22 String text = response.getText() ; 23 boolean b = text.indexOf(expectText_) >= 0 ; 24 if(b ==false) { 25 System.out.println("Expect text: " + expectText_) ; 27 } 28 return b ; 29 } 30 31 public String getName() { return "ExpectTextvalidator" ; } 32 33 public String getDescription() { 34 return "Make sure that the return xhtml has the following text '" + expectText_ + "'" ; 35 } 36 } | Popular Tags |