01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package test.handler;
08:
09: import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
10: import org.codehaus.aspectwerkz.joinpoint.CatchClauseRtti;
11: import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint;
12: import junit.framework.TestCase;
13:
14: /**
15: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
16: */
17: public class HandlerTestAspect {
18:
19: public void before(final JoinPoint joinPoint) throws Throwable {
20: HandlerTest.log("before ");
21: // AW-276 access the rtti
22: Throwable t = (Throwable) ((CatchClauseRtti) joinPoint
23: .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)
30: throws Throwable {
31: HandlerTest.log("before2 ");
32: Class exception = staticJoinPoint.getCalleeClass();
33: if (exception == null) {
34: TestCase.fail("handler join point has invalid rttit");
35: }
36: }
37:
38: public void before3(final JoinPoint joinPoint,
39: HandlerTestBeforeException e) throws Throwable {
40: HandlerTest.log("before3 ");
41: if (e == null) {
42: TestCase.fail("handler join point has invalid rttit");
43: }
44: }
45: }
|