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