Bug 317344 - [plan] [itd] @Test annotation on ITD breaks the JUnit launcher
Summary: [plan] [itd] @Test annotation on ITD breaks the JUnit launcher
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 2.0.2   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Andrew Eisenberg CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-18 19:08 EDT by Andrew Eisenberg CLA
Modified: 2010-06-18 19:14 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.