public class BlockJUnit4ClassRunnerWithParameters extends BlockJUnit4ClassRunner
BlockJUnit4ClassRunner with parameters support. Parameters can be
injected via constructor or into annotated fields.| Constructor and Description |
|---|
BlockJUnit4ClassRunnerWithParameters(TestWithParameters test) |
| Modifier and Type | Method and Description |
|---|---|
protected Statement |
classBlock(RunNotifier notifier)
Constructs a
Statement to run all of the tests in the test class. |
java.lang.Object |
createTest()
Returns a new fixture for running a test.
|
protected java.lang.String |
getName()
Returns a name used to describe this Runner
|
protected java.lang.annotation.Annotation[] |
getRunnerAnnotations() |
protected java.lang.String |
testName(FrameworkMethod method)
Returns the name that describes
method for Descriptions. |
protected void |
validateConstructor(java.util.List<java.lang.Throwable> errors)
Adds to
errors if the test class has more than one constructor,
or if the constructor takes parameters. |
protected void |
validateFields(java.util.List<java.lang.Throwable> errors) |
collectInitializationErrors, computeTestMethods, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutchildrenInvoker, classRules, createTestClass, filter, getDescription, getTestClass, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClassespublic BlockJUnit4ClassRunnerWithParameters(TestWithParameters test) throws InitializationError
InitializationErrorpublic java.lang.Object createTest()
throws java.lang.Exception
BlockJUnit4ClassRunnercreateTest in class BlockJUnit4ClassRunnerjava.lang.Exceptionprotected java.lang.String getName()
ParentRunnergetName in class ParentRunner<FrameworkMethod>protected java.lang.String testName(FrameworkMethod method)
BlockJUnit4ClassRunnermethod for Descriptions.
Default implementation is the method's nametestName in class BlockJUnit4ClassRunnerprotected void validateConstructor(java.util.List<java.lang.Throwable> errors)
BlockJUnit4ClassRunnererrors if the test class has more than one constructor,
or if the constructor takes parameters. Override if a subclass requires
different validation rules.validateConstructor in class BlockJUnit4ClassRunnerprotected void validateFields(java.util.List<java.lang.Throwable> errors)
validateFields in class BlockJUnit4ClassRunnerprotected Statement classBlock(RunNotifier notifier)
ParentRunnerStatement to run all of the tests in the test class.
Override to add pre-/post-processing. Here is an outline of the
implementation:
ParentRunner.getChildren()
(subject to any imposed filter and sort).ClassRules on the test-class and superclasses.@BeforeClass methods on the test-class
and superclasses; if any throws an Exception, stop execution and pass the
exception on.@AfterClass methods on the test-class
and superclasses: exceptions thrown by previous steps are combined, if
necessary, with exceptions from AfterClass methods into a
MultipleFailureException.classBlock in class ParentRunner<FrameworkMethod>Statementprotected java.lang.annotation.Annotation[] getRunnerAnnotations()
getRunnerAnnotations in class ParentRunner<FrameworkMethod>