-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Description
Currently in order to apply any pre-processing, common approach is to override Runner (or subclass of it).
For example to add Spring Framework injection I'd use:
@RunWith(SpringJUnit4ClassRunner.class)
And for Unitils support I'd use:
@RunWith(UnitilsJUnit4TestClassRunner.class).
But what happens when you need support for both?
Unitils actually is trying to solve this problem by supporting some (but not all) of Spring annotations.
It would benefit Java world if JUnit would support something like this:
@ProcessWith({SpringJUnitTestProcessor.class, UnitilsJunitTestProcessor.class})
In this case default BlockJUnit4ClassRunner will be used but listed processors will take care of their own responsibilities and would not have to know about each other.
Each of the processors would have to implement so common interface with a method like this:
public void prepareTest(Object testInstance, Method testMethod).
If there is an interest in this features, I'd like to contribute.
NachoSoto
Metadata
Metadata
Assignees
Labels
No labels