1 /******************************************************************************************** 2 * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. * 3 * http://backport175.codehaus.org * 4 * --------------------------------------------------------------------------------------- * 5 * The software in this package is published under the terms of Apache License Version 2.0 * 6 * a copy of which has been included with this distribution in the license.txt file. * 7 *******************************************************************************************/ 8 package test.customproceed.aw438; 9 10 import junit.framework.TestCase; 11 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 12 13 /*** 14 * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> 15 */ 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 }