KickJava   Java API By Example, From Geeks To Geeks.

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


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: ExpectImageWithAltTextValidator.java,v 1.1 2004/10/11 23:36:06 tuan08 Exp $
14  **/

15 public class ExpectImageWithAltTextValidator implements Validator {
16   private String JavaDoc text_ ;
17   
18   public ExpectImageWithAltTextValidator(String JavaDoc text) {
19     text_ = text ;
20   }
21   
22   public boolean validate(WebResponse response, ExoWebClient client) throws Exception JavaDoc {
23     Object JavaDoc image = response.getImageWithAltText(text_) ;
24     return image != null ;
25   }
26   
27   public String JavaDoc getName() { return "ExpectImageWithAltTextValidator" ; }
28   
29   public String JavaDoc getDescription() {
30     return "Make sure that the return xhtml has the image with alt text '" + text_ + "'" ;
31   }
32 }
Popular Tags