We have a policy that all test classes extend a given test class. The base class sets the JUnit runner to use as well as checking other things about the test class, so not subclassing from it means that other things you're doing wrong aren't going to be checked. (The most serious of these is when there is a category indicating that a test is expensive to run, but because the runner isn't being used, the test will run even for the run-fast-tests build target.)
I figure this is going to involve parsing the Java code, but I can only seem to find parsers for class files. Is there a good parser out there somewhere for parsing Java source?
(This could tie into another question I was going to ask about enforcing use of certain Javadoc tags, since such a parser would surely also parse Javadoc.)
Alternatively is there a DRY way to set a JUnit runner without subclassing? The whole subclassing business is really, really inconvenient.