KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > optimizations > OptimizeTest


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.optimizations;
9
10 import junit.framework.TestCase;
11
12 /**
13  * @author <a HREF="mailto:alex@gnilux.com">Alexandre Vasseur</a>
14  */

15 public class OptimizeTest extends TestCase {
16
17     private static String JavaDoc s_log = "";
18
19     public static void log(String JavaDoc s) {
20         s_log += s + " ";
21     }
22
23 // public void testNothing() {
24
// s_log = "";
25
// IOptimize target = new OptimizeNothing();
26
// target.before();
27
// target.around();
28
// target.beforeAround();
29
// target.before(0);
30
// target.around(0);
31
// assertEquals("before around before around before0 around0 ", s_log);
32
// }
33
//
34
// public void testStaticJoinPoint() {
35
// s_log = "";
36
// IOptimize target = new OptimizeStaticJoinPoint();
37
// target.before();
38
// target.around();
39
// target.beforeAround();
40
// target.before(0);
41
// target.around(0);
42
// assertEquals("beforeSJP-before aroundSJP-around beforeSJP-beforeAround aroundSJP-beforeAround beforeSJP0 aroundSJP0 ", s_log);
43
// }
44
//
45
// public void testJoinPoint() {
46
// s_log = "";
47
// IOptimize target = new OptimizeJoinPoint();
48
// target.before();
49
// target.around();
50
// target.beforeAround();
51
// target.before(0);
52
// target.around(0);
53
// assertEquals(
54
// "beforeJP-before-OptimizeJoinPoint-OptimizeTest aroundJP-around-OptimizeJoinPoint-OptimizeTest beforeJP-beforeAround-OptimizeJoinPoint-OptimizeTest aroundJP-beforeAround-OptimizeJoinPoint-OptimizeTest beforeJP0 aroundJP0 ",
55
// s_log);
56
// }
57

58     public void testRtti() {
59         s_log = "";
60         IOptimize target = new OptimizeRtti();
61         target.before();
62         target.around();
63         target.beforeAround();
64         target.before(0);
65         target.around(0);
66     }
67
68     public static interface IOptimize {
69         public void before();
70         public void around();
71         public void beforeAround();
72         public void before(int arg);
73         public void around(int arg);
74     }
75
76     public static class OptimizeNothing implements IOptimize {
77
78         public void before() {
79         }
80
81         public void around() {
82         }
83
84         public void beforeAround() {
85         }
86
87         public void before(int arg) {
88         }
89
90         public void around(int arg) {
91         }
92     }
93
94     public static class OptimizeStaticJoinPoint implements IOptimize {
95
96         public void before() {
97         }
98
99         public void around() {
100         }
101
102         public void beforeAround() {
103         }
104
105         public void before(int arg) {
106         }
107
108         public void around(int arg) {
109         }
110     }
111
112     public static class OptimizeJoinPoint implements IOptimize {
113
114         public String JavaDoc toString() {return "OptimizeJoinPoint"; }
115
116         public void before() {
117         }
118
119         public void around() {
120         }
121
122         public void beforeAround() {
123         }
124
125         public void before(int arg) {
126         }
127
128         public void around(int arg) {
129         }
130     }
131
132     public static class OptimizeRtti implements IOptimize {
133
134         public String JavaDoc toString() {return "OptimizeRtti"; }
135
136         public void before() {
137         }
138
139         public void around() {
140         }
141
142         public void beforeAround() {
143         }
144
145         public void before(int arg) {
146         }
147
148         public void around(int arg) {
149         }
150     }
151
152     public static void main(String JavaDoc[] args) {
153         junit.textui.TestRunner.run(suite());
154     }
155
156     public static junit.framework.Test suite() {
157         return new junit.framework.TestSuite(OptimizeTest.class);
158     }
159
160     public String JavaDoc toString() {return "OptimizeTest";}
161
162 }
163
Popular Tags