@Test public void testInvoke() throws Throwable { MethodInvocation allianceInvocation = createMock(MethodInvocation.class); MethodInterceptor mockShiroInterceptor = createMock(MethodInterceptor.class); expect(mockShiroInterceptor.invoke(anyObject(AopAllianceMethodInvocationAdapter.class))).andAnswer(new IAnswer<Object>() { public Object answer() throws Throwable { return getCurrentArguments()[0]; } }); final Object expectedValue = new Object(); expect(allianceInvocation.proceed()).andReturn(expectedValue); replay(mockShiroInterceptor, allianceInvocation); AopAllianceMethodInterceptorAdapter underTest = new AopAllianceMethodInterceptorAdapter(mockShiroInterceptor); Object invocation = underTest.invoke(allianceInvocation); Object value = ((AopAllianceMethodInvocationAdapter) invocation).proceed(); assertSame("Adapter invocation returned a different value.", expectedValue, value); verify(mockShiroInterceptor, allianceInvocation); }
public Object invoke(MethodInvocation invocation) throws Throwable { return shiroInterceptor.invoke(new AopAllianceMethodInvocationAdapter(invocation)); }
AopAllianceMethodInterceptorAdapter implements MethodInterceptor { public Object invoke(MethodInvocation invocation) throws Throwable { return shiroInterceptor.invoke(new AopAllianceMethodInvocationAdapter(invocation)); } }
AopAllianceMethodInterceptorAdapter implements MethodInterceptor { public Object invoke(MethodInvocation invocation) throws Throwable { return shiroInterceptor.invoke(new AopAllianceMethodInvocationAdapter(invocation)); } AopAllianceMethodInterceptorAdapter(org.apache.shiro.aop.MethodInterceptor shiroInterceptor); }
AopAllianceMethodInterceptorAdapter implements MethodInterceptor { public Object invoke(MethodInvocation invocation) throws Throwable { return shiroInterceptor.invoke(new AopAllianceMethodInvocationAdapter(invocation)); } AopAllianceMethodInterceptorAdapter(org.apache.shiro.aop.MethodInterceptor shiroInterceptor); Object invoke(MethodInvocation invocation); @Override String toString(); }
AopAllianceMethodInterceptorAdapter implements MethodInterceptor { public Object invoke(MethodInvocation invocation) throws Throwable { return shiroInterceptor.invoke(new AopAllianceMethodInvocationAdapter(invocation)); } AopAllianceMethodInterceptorAdapter(org.apache.shiro.aop.MethodInterceptor shiroInterceptor); Object invoke(MethodInvocation invocation); @Override String toString();  }