KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > archie > impl > OfferTest


1 package org.sapia.archie.impl;
2
3 import java.util.Properties JavaDoc;
4
5 import junit.framework.TestCase;
6
7 /**
8  * @author Yanick Duchesne
9  * <dl>
10  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
11  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
12  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
13  * </dl>
14  */

15 public class OfferTest extends TestCase{
16   
17   /**
18    * @param arg0
19    */

20   public OfferTest(String JavaDoc arg0) {
21     super(arg0);
22   }
23   
24   public void testMatches(){
25     Properties JavaDoc attributes = new Properties JavaDoc();
26     attributes.put("attr1", "val1");
27     attributes.put("attr2", "val2");
28     attributes.put("attr3", "val3");
29     Offer offer = new Offer(attributes, "SomeObject");
30     
31     Properties JavaDoc constraints = new Properties JavaDoc();
32     constraints.setProperty("attr1", "val1");
33     super.assertTrue(offer.matches(constraints));
34     constraints.setProperty("attr2", "val2");
35     super.assertTrue(offer.matches(constraints));
36     constraints.setProperty("attr3", "val3");
37     super.assertTrue(offer.matches(constraints));
38     constraints.setProperty("attr4", "val4");
39     super.assertTrue(!offer.matches(constraints));
40   }
41 }
42
43
Popular Tags