Uri's answer got me thinking about what limitations JUnit 4 aquired by using annotations instead of a specific class hierarchy and interfaces the way JUnit 3 and earlier did. I'm wondering what limitations Annotations gave other people in using JUnit 4?
One for me was the difficulty in creating a suite of dynamically generated classes. I had to work around the fact that Suite.SuiteClasses is an annotation with the following runner:
public class IDEATester extends Suite {
public IDEATester(Class<?> setupClass) throws InitializationError {
super(setupClass, staticMethodToGetArrayOfTestClasses());
}
}
On the advantage side of annotations, @BeforeClass is miles ahead of the Test Fixture approach of JUnit 3.