KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > interceptor > MultiDispatcherTest


1 package org.sapia.ubik.rmi.interceptor;
2
3 import junit.framework.TestCase;
4
5
6 /**
7  * @author Yanick Duchesne
8  * <dl>
9  * <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>
10  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
11  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
12  * </dl>
13  */

14 public class MultiDispatcherTest extends TestCase {
15   /**
16    * Constructor for MultiDispatcherTest.
17    * @param arg0
18    */

19   public MultiDispatcherTest(String JavaDoc arg0) {
20     super(arg0);
21   }
22
23   public void testAdd() throws Exception JavaDoc {
24     MultiDispatcher d = new MultiDispatcher();
25     TestInterceptor t = new TestInterceptor();
26     d.addInterceptor(TestEvent.class, t);
27   }
28
29   public void testMultiAdd() throws Exception JavaDoc {
30     MultiDispatcher d = new MultiDispatcher();
31     TestInterceptor t1 = new TestInterceptor();
32     TestInterceptor t2 = new TestInterceptor();
33     d.addInterceptor(TestEvent.class, t1);
34     d.addInterceptor(TestEvent.class, t2);
35   }
36
37   public void testDispatch() throws Exception JavaDoc {
38     MultiDispatcher d = new MultiDispatcher();
39     TestInterceptor t1 = new TestInterceptor();
40     TestInterceptor t2 = new TestInterceptor();
41     d.addInterceptor(TestEvent.class, t1);
42     d.addInterceptor(TestEvent.class, t2);
43     d.dispatch(new TestEvent());
44     super.assertEquals(1, t1.count);
45     super.assertEquals(1, t2.count);
46   }
47 }
48
Popular Tags