scarycoder (1) [Avatar] Offline
#1
I have written aspects using annotations and its easy to test the advice code since it is contained in POJOs.

Is there a way to test the "pointcuts" i.e make sure that the aspects match the classes and methods defined in the pointcuts?

The reason I ask is because say a refactoring were to change the method names or parameter types of some aspected code, the aspects will not match and the fact that some or all aspects did not match will be found only at run time.
ramnivas (171) [Avatar] Offline
#2
Re: Testing AspectJ Code
There isn't a direct way to test pointcuts. Instead, you check for the overall effect of the application of an aspect. For example, if you have a security aspect, you call secure code and check that security code was invoked. In other words, you do integration testing as you would without aspects.

There have been a few ideas floating around to allow making assertions over pointcuts, but no implementation yet.

-Ramnivas