KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > handler > HandlerTestAspect


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 JavaDoc {
21         HandlerTest.log("before ");
22         // AW-276 access the rtti
23
Throwable JavaDoc t = (Throwable JavaDoc) ((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 JavaDoc {
30         HandlerTest.log("before2 ");
31         Class JavaDoc 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 JavaDoc {
38         HandlerTest.log("before3 ");
39         if (e == null) {
40             TestCase.fail("handler join point has invalid rttit");
41         }
42     }
43 }
Popular Tags