001: /**************************************************************************************
002: * Copyright (c) Jonas Bon?r, Alexandre Vasseur. All rights reserved. *
003: * http://aspectwerkz.codehaus.org *
004: * ---------------------------------------------------------------------------------- *
005: * The software in this package is published under the terms of the LGPL license *
006: * a copy of which has been included with this distribution in the license.txt file. *
007: **************************************************************************************/package test.optimizations;
008:
009: import junit.framework.TestCase;
010:
011: /**
012: * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur</a>
013: */
014: public class OptimizeTest extends TestCase {
015:
016: private static String s_log = "";
017:
018: public static void log(String s) {
019: s_log += s + " ";
020: }
021:
022: // public void testNothing() {
023: // s_log = "";
024: // IOptimize target = new OptimizeNothing();
025: // target.before();
026: // target.around();
027: // target.beforeAround();
028: // target.before(0);
029: // target.around(0);
030: // assertEquals("before around before around before0 around0 ", s_log);
031: // }
032: //
033: // public void testStaticJoinPoint() {
034: // s_log = "";
035: // IOptimize target = new OptimizeStaticJoinPoint();
036: // target.before();
037: // target.around();
038: // target.beforeAround();
039: // target.before(0);
040: // target.around(0);
041: // assertEquals("beforeSJP-before aroundSJP-around beforeSJP-beforeAround aroundSJP-beforeAround beforeSJP0 aroundSJP0 ", s_log);
042: // }
043: //
044: // public void testJoinPoint() {
045: // s_log = "";
046: // IOptimize target = new OptimizeJoinPoint();
047: // target.before();
048: // target.around();
049: // target.beforeAround();
050: // target.before(0);
051: // target.around(0);
052: // assertEquals(
053: // "beforeJP-before-OptimizeJoinPoint-OptimizeTest aroundJP-around-OptimizeJoinPoint-OptimizeTest beforeJP-beforeAround-OptimizeJoinPoint-OptimizeTest aroundJP-beforeAround-OptimizeJoinPoint-OptimizeTest beforeJP0 aroundJP0 ",
054: // s_log);
055: // }
056:
057: public void testRtti() {
058: s_log = "";
059: IOptimize target = new OptimizeRtti();
060: target.before();
061: target.around();
062: target.beforeAround();
063: target.before(0);
064: target.around(0);
065: }
066:
067: public static interface IOptimize {
068: public void before();
069:
070: public void around();
071:
072: public void beforeAround();
073:
074: public void before(int arg);
075:
076: public void around(int arg);
077: }
078:
079: public static class OptimizeNothing implements IOptimize {
080:
081: public void before() {
082: }
083:
084: public void around() {
085: }
086:
087: public void beforeAround() {
088: }
089:
090: public void before(int arg) {
091: }
092:
093: public void around(int arg) {
094: }
095: }
096:
097: public static class OptimizeStaticJoinPoint implements IOptimize {
098:
099: public void before() {
100: }
101:
102: public void around() {
103: }
104:
105: public void beforeAround() {
106: }
107:
108: public void before(int arg) {
109: }
110:
111: public void around(int arg) {
112: }
113: }
114:
115: public static class OptimizeJoinPoint implements IOptimize {
116:
117: public String toString() {
118: return "OptimizeJoinPoint";
119: }
120:
121: public void before() {
122: }
123:
124: public void around() {
125: }
126:
127: public void beforeAround() {
128: }
129:
130: public void before(int arg) {
131: }
132:
133: public void around(int arg) {
134: }
135: }
136:
137: public static class OptimizeRtti implements IOptimize {
138:
139: public String toString() {
140: return "OptimizeRtti";
141: }
142:
143: public void before() {
144: }
145:
146: public void around() {
147: }
148:
149: public void beforeAround() {
150: }
151:
152: public void before(int arg) {
153: }
154:
155: public void around(int arg) {
156: }
157: }
158:
159: public static void main(String[] args) {
160: junit.textui.TestRunner.run(suite());
161: }
162:
163: public static junit.framework.Test suite() {
164: return new junit.framework.TestSuite(OptimizeTest.class);
165: }
166:
167: public String toString() {
168: return "OptimizeTest";
169: }
170:
171: }
|