1 8 package test.reflection; 9 10 import junit.framework.TestCase; 11 12 19 public class ReflectionTest extends TestCase { 20 public void testSinglePointcutOnSuperClassWithOverridedMethodNonDelegating() { 21 OtherChild2 c = new OtherChild2(); 22 assertEquals(2, c.incr(1)); 23 24 Super2 s = new Super2(); 26 assertEquals(-2, s.incr(1)); 27 28 } 30 31 public void testStaticSinglePointcutOnSuperClassWithOverridedMethodNonDelegating() { 32 assertEquals(2, OtherChild2.incrStatic(1)); 33 34 assertEquals(-2, Super2.incrStatic(1)); 36 37 } 39 40 public void testSinglePointcutOnSuperClassWithOverridedMethodDelegating() { 41 Child2 c = new Child2(); 42 assertEquals(-3, c.incr(1)); 43 } 44 45 public void testStaticSinglePointcutOnSuperClassWithOverridedMethodDelegating() { 46 assertEquals(-3, Child2.incrStatic(1)); 47 } 48 49 public void testDualPointcutWithOverridedMethodNonDelegating() { 50 OtherChild c = new OtherChild(); 51 assertEquals(-2, c.incr(1)); 52 } 53 54 public void testStaticDualPointcutWithOverridedMethodNonDelegating() { 55 assertEquals(-2, OtherChild.incrStatic(1)); 56 } 57 58 public void testDualPointcutWithOverridedMethodDelegating() { 59 Child c = new Child(); 60 assertEquals(+3, c.incr(1)); 61 } 62 63 public void testStaticDualPointcutWithOverridedMethodDelegating() { 64 assertEquals(+3, Child.incrStatic(1)); 65 } 66 67 public void testDollar() { 68 Child c = new Child(); 69 assertEquals(-1, c.do$2(1)); 70 } 71 72 public void testReflectionCall() { 73 Child c = new Child(); 74 assertEquals(+3, c.reflectionCallIncr(1)); 75 } 76 77 78 public static void main(String [] args) { 80 junit.textui.TestRunner.run(suite()); 81 } 82 83 public static junit.framework.Test suite() { 84 return new junit.framework.TestSuite(ReflectionTest.class); 85 } 86 } | Popular Tags |