1 7 package com.tirsen.nanning; 8 9 import junit.framework.TestCase; 10 11 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 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 |