Bug 317344

Summary: [plan] [itd] @Test annotation on ITD breaks the JUnit launcher
Product: [Tools] AJDT Reporter: Andrew Eisenberg <andrew.eisenberg>
Component: CoreAssignee: Andrew Eisenberg <andrew.eisenberg>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0.2   
Target Milestone: 2.0.1   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:

Description Andrew Eisenberg CLA 2010-06-18 19:08:18 EDT
Having an @Test annotation on an ITD should cause the target class to be launchable as a JUnit test class in Eclipse, but instead, the JUnit4TestFinder gets confused.  It sees the @Test annotation on the ITD and tries to run the aspect as a JUnit test.  This fails with miserable consequences.

We need to weave into the JUnit4TestFinder class in order to convert references to ITDs into their mock target elements.
Comment 1 Andrew Eisenberg CLA 2010-06-18 19:11:52 EDT
I have a solution implemented in the 3.6 branch that fixes this problem using the approach described above.  A few caveates, though:

1. Both the Aspect and the target type must be in the scope being searched for tests.  If the aspect is, but the target class is not, then the test finder will just remove any results from the target class since it is not in the search scope.  If the target class is in the region, but the aspect is not, then the ITD will not be found and so will not be added as a test.

2. If the target class already has some tests in it, then the aspect does not need to be in the search scope.
Comment 2 Andrew Eisenberg CLA 2010-06-18 19:13:21 EDT
Fix committed with regression tests on the 3.6 branch.
Comment 3 Andrew Eisenberg CLA 2010-06-18 19:14:13 EDT
fixed.