01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package test.aopalliance;
08:
09: import junit.framework.TestCase;
10:
11: /**
12: * TODO test constructor and field interception
13: *
14: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
15: */
16: public class Test extends TestCase {
17:
18: private static String s_logString = "";
19:
20: public Test(String name) {
21: super (name);
22: }
23:
24: public void testExecution() throws Exception {
25: s_logString = "";
26: execution();
27: assertEquals(
28: "before-intercept execution test.aopalliance.Test execution() after-intercept ",
29: s_logString);
30: }
31:
32: public void testCall() throws Exception {
33: s_logString = "";
34: call();
35: assertEquals(
36: "before-intercept call test.aopalliance.Test call() after-intercept ",
37: s_logString);
38: }
39:
40: public static void main(String[] args) {
41: junit.textui.TestRunner.run(suite());
42: }
43:
44: public static junit.framework.Test suite() {
45: return new junit.framework.TestSuite(Test.class);
46: }
47:
48: public static void log(final String wasHere) {
49: s_logString += wasHere;
50: }
51:
52: public long execution() {
53: log("execution() ");
54: return 0x1L;
55: }
56:
57: public long call() {
58: log("call() ");
59: return 0x1L;
60: }
61: }
|