1 8 package test.customproceed.aw438; 9 10 import junit.framework.TestCase; 11 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 12 13 16 public class ArrayInCustomProceedTest extends TestCase { 17 private static String LOG = ""; 18 19 public static void log(String msg) { 20 LOG += msg; 21 } 22 23 public void target(Integer i, String [] ss) { 24 log("target"); 25 } 26 27 public void testTarget() { 28 LOG = ""; 29 target(new Integer (1), new String []{"a", "b"}); 30 assertEquals("AOP target", LOG); 31 } 32 33 public static void main(String [] args) { 34 junit.textui.TestRunner.run(suite()); 35 } 36 37 public static junit.framework.Test suite() { 38 return new junit.framework.TestSuite(ArrayInCustomProceedTest.class); 39 } 40 41 public static class Aspect { 42 43 public static interface MyJoinPoint extends JoinPoint { 44 Object proceed(Integer i, String [] objs); 45 } 46 47 public Object addRequestTag(MyJoinPoint jp, Integer i, String [] objs) throws Throwable { 48 log("AOP "); 49 return jp.proceed(i, objs); 50 } 51 52 } 53 54 } 55 | Popular Tags |