Project: JDT
Bug 204682 [JUnit] Any class that references org.junit.Test is run as a test
Reported: 2007-09-26 09:49:16 | Status: verified fixed

Build ID: I20070921-0919 Steps To Reproduce: If you place the following class in a package, and run all tests in the package, this class will also get picked up, and cause an error. This can make it challenging when trying to write custom JUnit runners. Does core provide a way to search for annotation classes only when they're actually used as annotations? package bug; import org.junit.Test; public class ReferencesTest { Test getTest() { return null; } } More information:

Files changed in fix:
org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/launcher/JUnit4TestFinder.java org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/launcher/JUnit4TestFinder.java org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit4TestFinderTest.java