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. |
Object |
createTest()
Returns a new fixture for running a test.
|
protected String |
getName()
Returns a name used to describe this Runner
|
protected Annotation[] |
getRunnerAnnotations() |
protected String |
testName(FrameworkMethod method)
Returns the name that describes
method for Descriptions. |
protected void |
validateConstructor(List<Throwable> errors)
Adds to
errors if the test class has more than one constructor,
or if the constructor takes parameters. |
protected void |
validateFields(List<Throwable> errors) |
collectInitializationErrors, computeTestMethods, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutchildrenInvoker, classRules, createTestClass, filter, getDescription, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolationpublic BlockJUnit4ClassRunnerWithParameters(TestWithParameters test) throws InitializationError
InitializationErrorpublic Object createTest() throws Exception
BlockJUnit4ClassRunnercreateTest in class BlockJUnit4ClassRunnerExceptionprotected String getName()
ParentRunnergetName in class ParentRunner<FrameworkMethod>protected String testName(FrameworkMethod method)
BlockJUnit4ClassRunnermethod for Descriptions.
Default implementation is the method's nametestName in class BlockJUnit4ClassRunnerprotected void validateConstructor(List<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(List<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 Annotation[] getRunnerAnnotations()
getRunnerAnnotations in class ParentRunner<FrameworkMethod>Copyright © 2002–2020 JUnit. All rights reserved.