KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > aopalliance > Test


1 /**************************************************************************************
2  * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3  * http://aspectwerkz.codehaus.org *
4  * ---------------------------------------------------------------------------------- *
5  * The software in this package is published under the terms of the LGPL license *
6  * a copy of which has been included with this distribution in the license.txt file. *
7  **************************************************************************************/

8 package test.aopalliance;
9
10 import junit.framework.TestCase;
11
12 /**
13  * TODO test constructor and field interception
14  *
15  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
16  */

17 public class Test extends TestCase {
18     
19     private static String JavaDoc s_logString = "";
20
21     public Test(String JavaDoc name) {
22         super(name);
23     }
24
25     public void testExecution() throws Exception JavaDoc {
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 JavaDoc {
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 JavaDoc[] 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 JavaDoc 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