KickJava   Java API By Example, From Geeks To Geeks.

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


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.*;
8 import com.meterware.httpunit.*;
9 /**
10  * May 21, 2004
11  * @author: Tuan Nguyen
12  * @email: tuan08@users.sourceforge.net
13  * @version: $Id: ExpectFormNameValidator.java,v 1.1 2004/10/11 23:36:06 tuan08 Exp $
14  **/

15 public class ExpectFormNameValidator implements Validator {
16   private String JavaDoc formName_ ;
17   
18   public ExpectFormNameValidator(String JavaDoc formName) {
19     formName_ = formName ;
20   }
21   
22   public boolean validate(WebResponse response, ExoWebClient client) throws Exception JavaDoc {
23     WebForm form = Util.findFormWithName(response, null, formName_) ;
24     if(form == null) return false ;
25     return true ;
26   }
27   
28   public String JavaDoc getName() { return "ExpectFormNameValidator" ; }
29   
30   public String JavaDoc getDescription() {
31     return "Make sure that the return xhtml has the form with the name '" + formName_ + "'" ;
32   }
33 }
Popular Tags