KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > test > web > validator > ExpectNoTextValidator


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.test.web.validator;
6
7 import org.exoplatform.test.web.ExoWebClient;
8 import com.meterware.httpunit.*;
9 /**
10  * May 21, 2004
11  * @author: Tuan Nguyen
12  * @email: tuan08@users.sourceforge.net
13  * @version: $Id: ExpectNoTextValidator.java,v 1.1 2004/10/11 23:36:06 tuan08 Exp $
14  **/

15 public class ExpectNoTextValidator implements Validator {
16   private String JavaDoc expectText_ ;
17   public ExpectNoTextValidator(String JavaDoc text) {
18     expectText_ = text ;
19   }
20   
21   public boolean validate(WebResponse response, ExoWebClient client) throws Exception JavaDoc {
22     String JavaDoc text = response.getText() ;
23     boolean b = text.indexOf(expectText_) < 0 ;
24     return b ;
25   }
26   
27   public String JavaDoc getName() { return "ExpectNoTextvalidator" ; }
28   
29   public String JavaDoc getDescription() {
30     return "Make sure that the return xhtml do not have the following text '" + expectText_ + "'" ;
31   }
32 }
Popular Tags