KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > customproceed > aw438 > ArrayInCustomProceedTest


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 JavaDoc LOG = "";
18
19     public static void log(String JavaDoc msg) {
20         LOG += msg;
21     }
22
23     public void target(Integer JavaDoc i, String JavaDoc[] ss) {
24         log("target");
25     }
26
27     public void testTarget() {
28         LOG = "";
29         target(new Integer JavaDoc(1), new String JavaDoc[]{"a", "b"});
30         assertEquals("AOP target", LOG);
31     }
32
33     public static void main(String JavaDoc[] 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 JavaDoc proceed(Integer JavaDoc i, String JavaDoc[] objs);
45         }
46
47         public Object JavaDoc addRequestTag(MyJoinPoint jp, Integer JavaDoc i, String JavaDoc[] objs) throws Throwable JavaDoc {
48             log("AOP ");
49             return jp.proceed(i, objs);
50         }
51
52     }
53
54 }
55
Popular Tags