public class JUnitParametricRunner
extends BlockJUnit4ClassRunner
ParametricTest
to decide how test data will be retrieved.
It also runs regular JUnit test annotated with @Test. In this cases, there is no data injection.Constructor and Description |
---|
JUnitParametricRunner(Class<?> clazz) |
Modifier and Type | Method and Description |
---|---|
protected List<FrameworkMethod> |
computeTestMethods() |
protected TestRule |
getExpectedExceptionRule(FrameworkMethod testMethod)
Gets a new expected exception rule for the current test method.
|
protected Collection<TestRule> |
getRules(Object test,
FrameworkMethod testMethod,
Object[] testParamsValues)
Gets the rules for the given test.
|
protected TestDataProvider |
getTestDataProvider(FrameworkMethod testMethod)
Gets the test data provider instance from the given annotation.
|
protected ParametricTestWrapper |
getTestMethodStatement(FrameworkMethod testMethod,
Object[] testParamsValues)
Gets the statement for a parametric test method.
|
protected Collection<ParametricTestWrapper> |
getTestMethodStatements(FrameworkMethod testMethod)
Gets the statements for a parametric test method.
|
protected TestRule |
getTimeoutRule(FrameworkMethod testMethod)
Gets a new timeout rule for the current test method.
|
protected void |
runChild(FrameworkMethod testMethod,
RunNotifier notifier) |
protected void |
runParametricTest(FrameworkMethod testMethod)
Runs a parametric test.
|
protected void |
validatePublicVoidNoArgs(List<FrameworkMethod> methods,
boolean isStatic,
List<Throwable> errors)
Validate the passed methods (usually methods annotated with @Test but not @ParametricTest) as
"public void no args".
|
protected void |
validatePublicVoidOneArg(List<FrameworkMethod> methods,
boolean isStatic,
List<Throwable> errors)
Validate the passed methods (usually methods annotated with @ParametricTest) as "public void one arg".
|
protected void |
validateTestMethods(List<Throwable> errors) |
public JUnitParametricRunner(Class<?> clazz) throws InitializationError
InitializationError
BlockJUnit4ClassRunner#BlockJUnit4ClassRunner(java.lang.Class)
protected List<FrameworkMethod> computeTestMethods()
BlockJUnit4ClassRunner#computeTestMethods()
protected TestDataProvider getTestDataProvider(FrameworkMethod testMethod) throws InvalidParametricTestException
testMethod
- Test method that will be executed.InvalidParametricTestException
- If the test data provider cannot be created.protected TestRule getExpectedExceptionRule(FrameworkMethod testMethod)
testMethod
- Test method that will be executed.protected TestRule getTimeoutRule(FrameworkMethod testMethod)
testMethod
- Test method that will be executed.protected Collection<TestRule> getRules(Object test, FrameworkMethod testMethod, Object[] testParamsValues)
ParametricTestWrapperRule
.test
- Test that the rules must be retrieved for.testMethod
- The test method for the statement.testParamsValues
- The values of the parameters to be used in the test.protected ParametricTestWrapper getTestMethodStatement(FrameworkMethod testMethod, Object[] testParamsValues)
testMethod
- The test method for the statement.testParamsValues
- The values of the parameters to be used in the test.protected Collection<ParametricTestWrapper> getTestMethodStatements(FrameworkMethod testMethod) throws InvalidParametricTestException
testMethod
- The test method for the statements.InvalidParametricTestException
- If the test data is not available.protected void runParametricTest(FrameworkMethod testMethod) throws InvalidParametricTestException, ParametricTestException
testMethod
- The test method to run.InvalidParametricTestException
- If the test data is not available.ParametricTestException
- If any of the parametric test instances throws an exception.protected void runChild(FrameworkMethod testMethod, RunNotifier notifier)
org.junit.runners.BlockJUnit4ClassRunner#runChild(org.junit.runners.model.FrameworkMethod,
org.junit.runner.notification.RunNotifier)
protected void validatePublicVoidNoArgs(List<FrameworkMethod> methods, boolean isStatic, List<Throwable> errors)
methods
- Methods to be validated.isStatic
- If the method must or must not be static.errors
- Errors list where new validation errors should be added.protected void validatePublicVoidOneArg(List<FrameworkMethod> methods, boolean isStatic, List<Throwable> errors)
methods
- Methods to be validated.isStatic
- If the method must or must not be static.errors
- Errors list where new validation errors should be added.Copyright © 2012. All Rights Reserved.