KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > test > web > condition > HaveLinkWithTextCondition


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.condition;
6
7 import org.exoplatform.test.web.ExoWebClient;
8 import com.meterware.httpunit.*;
9
10 /**
11  * May 21, 2004
12  * @author: Tuan Nguyen
13  * @email: tuan08@users.sourceforge.net
14  * @version: $Id: HaveLinkWithTextCondition.java,v 1.1 2004/10/11 23:36:04 tuan08 Exp $
15  **/

16 public class HaveLinkWithTextCondition implements Condition {
17   private String JavaDoc text_ ;
18   
19   public HaveLinkWithTextCondition(String JavaDoc text) {
20     text_ = text ;
21   }
22   
23   public boolean checkCondition(WebResponse response, WebTable block, ExoWebClient client) throws Exception JavaDoc {
24     WebLink link = response.getLinkWith(text_) ;
25     return link != null ;
26   }
27   
28   public String JavaDoc getName() { return "HaveLinkWithTextCondition" ; }
29   public String JavaDoc getDescription() {
30     return "This unit test should run only if the previous return response has the the text '" + text_ + "'" ;
31   }
32 }
Popular Tags