KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > validator > rules > SelectTest


1 package org.sapia.validator.rules;
2
3 import junit.framework.TestCase;
4
5 import org.sapia.validator.*;
6 import org.sapia.validator.examples.*;
7
8 /**
9  * @author Yanick Duchesne
10  * 28-Apr-2003
11  */

12 public class SelectTest extends TestCase {
13   /**
14    * Constructor for SelectTest.
15    * @param arg0
16    */

17   public SelectTest(String JavaDoc arg0) {
18     super(arg0);
19   }
20
21   public void testSelect() throws Exception JavaDoc {
22     Vlad v = new Vlad();
23     RuleSet rs = new RuleSet();
24
25     rs.setId("select");
26
27     Select s = new Select();
28
29     s.setAttribute("name");
30
31     TestRule t1 = new TestRule(false);
32
33     s.handleObject("someRule", t1);
34     rs.addValidatable(s);
35     v.addRuleSet(rs);
36     v.validate("select", new Company("ACME"), java.util.Locale.getDefault());
37     super.assertTrue("TestRule 1 was not called", t1.wasCalled());
38   }
39 }
40
Popular Tags