1 8 package test.aopalliance; 9 10 import junit.framework.TestCase; 11 12 17 public class Test extends TestCase { 18 19 private static String s_logString = ""; 20 21 public Test(String name) { 22 super(name); 23 } 24 25 public void testExecution() throws Exception { 26 s_logString = ""; 27 execution(); 28 assertEquals("before-intercept execution test.aopalliance.Test execution() after-intercept ", s_logString); 29 } 30 31 public void testCall() throws Exception { 32 s_logString = ""; 33 call(); 34 assertEquals("before-intercept call test.aopalliance.Test call() after-intercept ", s_logString); 35 } 36 37 public static void main(String [] args) { 38 junit.textui.TestRunner.run(suite()); 39 } 40 41 public static junit.framework.Test suite() { 42 return new junit.framework.TestSuite(Test.class); 43 } 44 45 public static void log(final String wasHere) { 46 s_logString += wasHere; 47 } 48 49 public long execution() { 50 log("execution() "); 51 return 0x1L; 52 } 53 54 public long call() { 55 log("call() "); 56 return 0x1L; 57 } 58 } 59 | Popular Tags |