KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tirsen > nanning > AspectsTest


1 /*
2  * Nanning Aspects
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package com.tirsen.nanning;
8
9 import junit.framework.TestCase;
10
11 /**
12  * TODO document AspectsTest
13  *
14  * <!-- $Id: AspectsTest.java,v 1.6 2003/05/11 13:40:52 tirsen Exp $ -->
15  *
16  * @author $Author: tirsen $
17  * @version $Revision: 1.6 $
18  */

19 public class AspectsTest extends TestCase {
20     public static class OtherImpl extends IntfImpl {
21     }
22
23     public void testSetTarget() {
24         AspectInstance instance = new AspectInstance();
25         MixinInstance mixin = new MixinInstance(Intf.class, new IntfImpl());
26         instance.addMixin(mixin);
27         Object JavaDoc proxy = instance.getProxy();
28
29         assertTrue(Aspects.getTarget(proxy, Intf.class) instanceof IntfImpl);
30
31         OtherImpl other = new OtherImpl();
32         Aspects.setTarget(proxy, Intf.class, other);
33         assertSame("did not change target", other, Aspects.getTarget(proxy, Intf.class));
34     }
35 }
36
Popular Tags