1 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 18 public class HandlerTestAspect { 19 20 public void before(final JoinPoint joinPoint) throws Throwable { 21 HandlerTest.log("before "); 22 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 } | Popular Tags |