1 10 package org.nanocontainer.aop.dynaop; 11 12 import dynaop.Invocation; 13 import org.aopalliance.intercept.MethodInterceptor; 14 import org.aopalliance.intercept.MethodInvocation; 15 import org.jmock.Mock; 16 import org.jmock.MockObjectTestCase; 17 18 21 public class MethodInterceptorAdapterTestCase extends MockObjectTestCase { 22 23 private Mock mockMethodInterceptor = mock(MethodInterceptor.class); 24 private Mock mockInvocation = mock(Invocation.class); 25 26 public void testInvoke() throws Throwable { 27 mockMethodInterceptor.expects(once()).method("invoke").with(isA(MethodInvocation.class)).will(returnValue("result")); 28 29 dynaop.Interceptor interceptor = new MethodInterceptorAdapter((MethodInterceptor) mockMethodInterceptor.proxy()); 30 Object result = interceptor.intercept((Invocation) mockInvocation.proxy()); 31 assertEquals("result", result); 32 } 33 34 } | Popular Tags |