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.pointcutexpression;
008:
009: import junit.framework.TestCase;
010:
011: /**
012: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
013: */
014: public class PointcutExpressionTest extends TestCase {
015: public static String s_logString = "";
016:
017: public PointcutExpressionTest(String name) {
018: super (name);
019: }
020:
021: public void test_OR() {
022: s_logString = "";
023: B();
024: assertEquals("before1 B after1 ", s_logString);
025: s_logString = "";
026: C();
027: assertEquals("before1 C after1 ", s_logString);
028: }
029:
030: public void test_AND_NEG() {
031: s_logString = "";
032: D();
033: assertEquals("before1 D after1 ", s_logString);
034: s_logString = "";
035: E();
036: assertEquals("E ", s_logString);
037: }
038:
039: public void test_OR_AND() {
040: s_logString = "";
041: F();
042: assertEquals("F ", s_logString);
043: s_logString = "";
044: G();
045: assertEquals("G ", s_logString);
046: }
047:
048: public void test_OR_AND_GENERIC() {
049: s_logString = "";
050: I();
051: assertEquals("before1 I after1 ", s_logString);
052: s_logString = "";
053: J();
054: assertEquals("before1 J after1 ", s_logString);
055: }
056:
057: public void test_COMPLEX() {
058: s_logString = "";
059: K();
060: assertEquals("K ", s_logString);
061: s_logString = "";
062: L();
063: assertEquals("L ", s_logString);
064: s_logString = "";
065: M();
066: assertEquals("M ", s_logString);
067: s_logString = "";
068: N();
069: assertEquals("before1 N after1 ", s_logString);
070: }
071:
072: public void test_SIMPLE() {
073: s_logString = "";
074: O();
075: assertEquals("before1 O after1 ", s_logString);
076: }
077:
078: public static void main(String[] args) {
079: junit.textui.TestRunner.run(suite());
080: }
081:
082: public static junit.framework.Test suite() {
083: return new junit.framework.TestSuite(
084: PointcutExpressionTest.class);
085: }
086:
087: // ==== methods to test ====
088: public static void log(final String wasHere) {
089: s_logString += wasHere;
090: }
091:
092: public void A() {
093: log("A ");
094: }
095:
096: public void B() {
097: log("B ");
098: }
099:
100: public void C() {
101: log("C ");
102: }
103:
104: public void D() {
105: log("D ");
106: }
107:
108: public void E() {
109: log("E ");
110: }
111:
112: public void F() {
113: log("F ");
114: }
115:
116: public void G() {
117: log("G ");
118: }
119:
120: public void H() {
121: log("H ");
122: }
123:
124: public void I() {
125: log("I ");
126: }
127:
128: public void J() {
129: log("J ");
130: }
131:
132: public void K() {
133: log("K ");
134: }
135:
136: public void L() {
137: log("L ");
138: }
139:
140: public void M() {
141: log("M ");
142: }
143:
144: public void N() {
145: log("N ");
146: }
147:
148: public void O() {
149: log("O ");
150: }
151: }
|