Class TestParameterInjector
- java.lang.Object
-
- org.junit.runner.Runner
-
- org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
- org.junit.runners.BlockJUnit4ClassRunner
-
- com.google.testing.junit.testparameterinjector.TestParameterInjector
-
- All Implemented Interfaces:
org.junit.runner.Describable
,org.junit.runner.manipulation.Filterable
,org.junit.runner.manipulation.Orderable
,org.junit.runner.manipulation.Sortable
public final class TestParameterInjector extends org.junit.runners.BlockJUnit4ClassRunner
A JUnit4 test runner which knows how to instantiate and run test classes where each test case may be parameterized with its own unique set of test parameters.
-
-
Constructor Summary
Constructors Constructor Description TestParameterInjector(Class<?> testClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
collectInitializationErrors(List<Throwable> errors)
com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod>
computeTestMethods()
protected Object
createTest()
protected void
finalizeCreatedTestInstance(Object testInstance)
This method is run to perform optional additional operations on the test instance, right after it was created.protected List<org.junit.rules.TestRule>
getExtraTestRules()
TestRule
s that will be executed before the ones defined in the test class.protected com.google.common.collect.ImmutableList<Class<? extends Annotation>>
getSupportedTestAnnotations()
Returns classes used as annotations to indicate test methods.org.junit.runners.model.Statement
methodBlock(org.junit.runners.model.FrameworkMethod method)
org.junit.runners.model.Statement
methodInvoker(org.junit.runners.model.FrameworkMethod frameworkMethod, Object testObject)
protected com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod>
sortTestMethods(com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod> methods)
Sort test methods (across different TestMethodProcessors).protected void
validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors)
protected void
validateTestMethods(List<Throwable> errorsReturned)
protected void
validateZeroArgConstructor(List<Throwable> errorsReturned)
-
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
createTest, describeChild, getChildren, getTestRules, isIgnored, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, withAfters, withBefores, withPotentialTimeout
-
-
-
-
Constructor Detail
-
TestParameterInjector
public TestParameterInjector(Class<?> testClass) throws org.junit.runners.model.InitializationError
- Throws:
org.junit.runners.model.InitializationError
-
-
Method Detail
-
finalizeCreatedTestInstance
protected void finalizeCreatedTestInstance(Object testInstance)
This method is run to perform optional additional operations on the test instance, right after it was created.
-
sortTestMethods
protected com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod> sortTestMethods(com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod> methods)
Sort test methods (across different TestMethodProcessors).This should be deterministic. The order should not change, even when tests are added/removed or between releases.
-
getSupportedTestAnnotations
protected com.google.common.collect.ImmutableList<Class<? extends Annotation>> getSupportedTestAnnotations()
Returns classes used as annotations to indicate test methods.Defaults to
Test
.
-
getExtraTestRules
protected List<org.junit.rules.TestRule> getExtraTestRules()
TestRule
s that will be executed before the ones defined in the test class. This is meant to be overridden by subclasses.
-
computeTestMethods
public final com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod> computeTestMethods()
- Overrides:
computeTestMethods
in classorg.junit.runners.BlockJUnit4ClassRunner
-
methodBlock
public final org.junit.runners.model.Statement methodBlock(org.junit.runners.model.FrameworkMethod method)
- Overrides:
methodBlock
in classorg.junit.runners.BlockJUnit4ClassRunner
-
methodInvoker
public final org.junit.runners.model.Statement methodInvoker(org.junit.runners.model.FrameworkMethod frameworkMethod, Object testObject)
- Overrides:
methodInvoker
in classorg.junit.runners.BlockJUnit4ClassRunner
-
validateZeroArgConstructor
protected final void validateZeroArgConstructor(List<Throwable> errorsReturned)
- Overrides:
validateZeroArgConstructor
in classorg.junit.runners.BlockJUnit4ClassRunner
-
validateTestMethods
protected final void validateTestMethods(List<Throwable> errorsReturned)
- Overrides:
validateTestMethods
in classorg.junit.runners.BlockJUnit4ClassRunner
-
collectInitializationErrors
protected final void collectInitializationErrors(List<Throwable> errors)
- Overrides:
collectInitializationErrors
in classorg.junit.runners.BlockJUnit4ClassRunner
-
createTest
protected final Object createTest() throws Exception
- Overrides:
createTest
in classorg.junit.runners.BlockJUnit4ClassRunner
- Throws:
Exception
-
validatePublicVoidNoArgMethods
protected final void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors)
- Overrides:
validatePublicVoidNoArgMethods
in classorg.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
-