KentBeck/junit — pull request #352 by vasiliygagin (2011-10-26 18:22:47+00:00)
Title: CustomizableJUnit4ClassRunner

I have implemented CustomizableJUnit4ClassRunner. Not sure if you will lake the idea.
I did not dare to modify BlockJUnitRunner, because change is too big.
In short changes are:
1) CustomizableJUnit4ClassRunner is an equivalent of BlockJUnitRunner. Can be customized via TestFactory support different test discovery mechanisms.
2) added TestFactory interface and its implementation ReflectionTestFactory. That is there tests based on @test are dicovered.
3) added @TestFactories annotation, to specify multiple test factories. If omitted ReflectionTestFactory is used by default. Could be part of @RunWith.
4) Added FrameworkTest interface. Since supporting tests not based on FrameworkMethod, needed something else.
5) Added AnnotatedFrameworkTest, the implementation of FrameworkTest. This is created by ReflectionTestFactory. FrameworkMethod specific code got moved here and Statement creation.
6) Not related by makes things clear: Instead of using RunBefores and RunAfters with @before and @after, adapted them to TestRule with new classes BeforeRule and AfterRule.

Whole thing if used simply as @RunWith(CustomizableJUnit4ClassRunner.class) should behave exactly as BlockJUnitRunner would. Except that some deprecated code was eliminated, namely MethodRules.

If any part of this makes any sense, please let me now I can, clean it up add some test cases.