Unit testing Spring @Around AOP methods
You can test a Spring Aspect by creating a proxy programatically:
MyInterface target = new MyClass();AspectJProxyFactory factory = new AspectJProxyFactory(target);MyAspect aspect = new MyAspect(arg);factory.addAspect(aspect);MyInterface proxy = factory.getProxy();
... then you can call methods on proxy
, and make assertions about aspect
, proxy
and target
.