KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > spring > 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.spring;
9
10 import junit.framework.TestCase;
11
12 /**
13  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
14  */

15 public class Test extends TestCase {
16
17     private static String JavaDoc s_logString = "";
18
19     public Test(String JavaDoc name) {
20         super(name);
21     }
22
23     public void testBefore() throws Exception JavaDoc {
24         s_logString = "";
25         adviseBefore();
26         assertEquals("before adviseBefore ", s_logString);
27      }
28
29     public void testAfterReturning() throws Exception JavaDoc {
30         s_logString = "";
31         adviseAfterReturning();
32         assertEquals("adviseAfterReturning afterReturning ", s_logString);
33      }
34
35     public static void main(String JavaDoc[] args) {
36         junit.textui.TestRunner.run(suite());
37     }
38
39     public static junit.framework.Test suite() {
40         return new junit.framework.TestSuite(Test.class);
41     }
42
43     public static void log(final String JavaDoc wasHere) {
44         s_logString += wasHere;
45     }
46
47     public long adviseAfterReturning() {
48         log("adviseAfterReturning ");
49         return 0x1L;
50     }
51
52     public long adviseBefore() {
53         log("adviseBefore ");
54         return 0x1L;
55     }
56 }
57
Popular Tags