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 org.codehaus.aspectwerkz.joinpoint.JoinPoint;
11 import org.codehaus.aspectwerkz.joinpoint.CatchClauseRtti;
12 import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint;
13 import junit.framework.TestCase;
14
15 /***
16 * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
17 */
18 public class HandlerTestAspect {
19
20 public void before(final JoinPoint joinPoint) throws Throwable {
21 HandlerTest.log("before ");
22
23 Throwable t = (Throwable) ((CatchClauseRtti) joinPoint.getRtti()).getParameterValue();
24 if (t == null) {
25 TestCase.fail("handler join point has invalid rttit");
26 }
27 }
28
29 public void before2(final StaticJoinPoint staticJoinPoint) throws Throwable {
30 HandlerTest.log("before2 ");
31 Class exception = staticJoinPoint.getCalleeClass();
32 if (exception == null) {
33 TestCase.fail("handler join point has invalid rttit");
34 }
35 }
36
37 public void before3(final JoinPoint joinPoint, HandlerTestBeforeException e) throws Throwable {
38 HandlerTest.log("before3 ");
39 if (e == null) {
40 TestCase.fail("handler join point has invalid rttit");
41 }
42 }
43 }