KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > pointcutexpression > PointcutExpressionTest


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

15 public class PointcutExpressionTest extends TestCase {
16     public static String JavaDoc s_logString = "";
17
18     public PointcutExpressionTest(String JavaDoc name) {
19         super(name);
20     }
21
22     public void test_OR() {
23         s_logString = "";
24         B();
25         assertEquals("before1 B after1 ", s_logString);
26         s_logString = "";
27         C();
28         assertEquals("before1 C after1 ", s_logString);
29     }
30
31     public void test_AND_NEG() {
32         s_logString = "";
33         D();
34         assertEquals("before1 D after1 ", s_logString);
35         s_logString = "";
36         E();
37         assertEquals("E ", s_logString);
38     }
39
40     public void test_OR_AND() {
41         s_logString = "";
42         F();
43         assertEquals("F ", s_logString);
44         s_logString = "";
45         G();
46         assertEquals("G ", s_logString);
47     }
48
49     public void test_OR_AND_GENERIC() {
50         s_logString = "";
51         I();
52         assertEquals("before1 I after1 ", s_logString);
53         s_logString = "";
54         J();
55         assertEquals("before1 J after1 ", s_logString);
56     }
57
58     public void test_COMPLEX() {
59         s_logString = "";
60         K();
61         assertEquals("K ", s_logString);
62         s_logString = "";
63         L();
64         assertEquals("L ", s_logString);
65         s_logString = "";
66         M();
67         assertEquals("M ", s_logString);
68         s_logString = "";
69         N();
70         assertEquals("before1 N after1 ", s_logString);
71     }
72
73     public void test_SIMPLE() {
74         s_logString = "";
75         O();
76         assertEquals("before1 O after1 ", s_logString);
77     }
78
79     public static void main(String JavaDoc[] args) {
80         junit.textui.TestRunner.run(suite());
81     }
82
83     public static junit.framework.Test suite() {
84         return new junit.framework.TestSuite(PointcutExpressionTest.class);
85     }
86
87     // ==== methods to test ====
88
public static void log(final String JavaDoc wasHere) {
89         s_logString += wasHere;
90     }
91
92     public void A() {
93         log("A ");
94     }
95
96     public void B() {
97         log("B ");
98     }
99
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 }
Popular Tags