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.handler;
9
10 import junit.framework.TestCase;
11
12 /***
13 * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
14 */
15 public class HandlerTest extends TestCase {
16 private static String s_log = "";
17
18 public HandlerTest() {
19 }
20
21 public HandlerTest(String name) {
22 super(name);
23 }
24
25 public void testBeforeAdvice() {
26 s_log = "";
27 try {
28 throw new HandlerTestBeforeException();
29 } catch (HandlerTestBeforeException e) {
30 log("before ");
31 }
32 assertEquals("pre before ", s_log);
33 }
34
35 public static void main(String[] args) {
36 junit.textui.TestRunner.run(suite());
37 }
38
39 public static junit.framework.Test suite() {
40 return new junit.framework.TestSuite(HandlerTest.class);
41 }
42
43 public static void log(final String wasHere) {
44 s_log += wasHere;
45 }
46 }