@Test
public void testProgramaticPointcut() {
final RepositoryPointcutInterface targetPointcutInterface = new RepositoryPointcutInterfaceImpl();
final AspectJProxyFactory portletPreferencesProxyFactory = new AspectJProxyFactory(targetPointcutInterface);
final Method interceptorMethod = ReflectionUtils.findMethod(CountingMethodInterceptor.class, "countInvocation", ProceedingJoinPoint.class);
final AspectJAroundAdvice aspectJAroundAdvice = new AspectJAroundAdvice(
interceptorMethod,
repositoryPointcutInterfaceExecutionPointcut,
new SingletonAspectInstanceFactory(this.countingMethodInterceptor));
portletPreferencesProxyFactory.addAdvice(aspectJAroundAdvice);
final RepositoryPointcutInterface proxiedPointcutInterface = (RepositoryPointcutInterface) portletPreferencesProxyFactory.getProxy();
assertEquals(0, countingMethodInterceptor.getCount());
proxiedPointcutInterface.methodOne("test");
assertEquals(1, countingMethodInterceptor.getCount());
proxiedPointcutInterface.methodOne("test");