I have a set of Junit 4 test classes which I want to run in multiple modules with differing BeforeClass, AfterClass, Before and After hooks. With @Rule injections I get only wrapping of test methods, but no BeforeClass and AfterClass behaviour.

Also I don't want to do this with a test runner, since then I have fixed the test runner to be used for a large set of tests.

Subclassing each test class in the target modules and applying the customizations there doesn't seem to be a good solution.

The best would be to just declared something like this in the target modules

@RunWith(Suite.class)
@Suite.SuiteClasses({
investmentTests.class,
catalogTests.class,
markerTests.class
})
public class AllTests {
// why on earth I need this class, I have no idea!
}