1 package dynaop; 2 3 import java.util.List ; 4 import java.util.RandomAccess ; 5 6 import junit.framework.TestCase; 7 8 13 public class ClassProxyCreatorTest extends TestCase { 14 15 public void testProxyCreation() { 16 ProxyTypeBuilder builder = new ProxyTypeBuilder(Foo.class); 17 builder.addInterface(RandomAccess .class); 18 builder.addInterface(List .class); 19 ProxyType type = builder.createProxyType(); 20 ClassProxyCreator creator = new ClassProxyCreator(type, Foo.class); 21 22 Object proxy = creator.createProxy(null); 23 assertTrue(proxy instanceof RandomAccess ); 24 assertTrue(proxy instanceof List ); 25 26 proxy = creator.createProxy(null); 27 assertTrue(proxy instanceof RandomAccess ); 28 assertTrue(proxy instanceof List ); 29 30 assertEquals(type, creator.getProxyType()); 31 } 32 33 public static class Foo { 34 public void foo() {} 35 } 36 } 37 | Popular Tags |