| Author |
Writing Struts Action unit tests with AspectJ
|
al agady
Greenhorn
Joined: Feb 07, 2004
Posts: 7
|
|
I am trying to create Struts unit test using AspectJ. I installed AJDT plugin in Eclipse, and created an easy aspect. There are only two pointcuts and two advices in the aspect. The first advice gets applied, and the second does not get applied because it doesn't find right match (can not find a match for Action "execute" method. I can not figure out why. Did someone had similar problems with applying advice to "execute" method :
Here is my code (advice highligted in green, gets applied, advice hightligted in red does not get applied):
public aspect ErrorLookupAspect {
pointcut errorLookupTest(ErrorLookupActionTest actionTest):
execution(public void ErrorLookupActionTest+.test*())
&& this(actionTest);
pointcut actionExecute()
: execution(public ActionForward ErrorLookupAction.execute(..));
before(ErrorLookupActionTest actionTest)
: errorLookupTest(actionTest){
System.out.println("Before Test");
}
before(): actionExecute(){
System.out.println("Executing");
}}
|
 |
Emil Jennings
Ranch Hand
Joined: Jul 09, 2010
Posts: 40
|
|
|
Can you include the classes that you are trying to apply the aspect to? It will make it easier to compare to the join points in the aspect.
|
 |
 |
|
|
subject: Writing Struts Action unit tests with AspectJ
|
|
|