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 Description s. |
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, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
childrenInvoker, classRules, createTestClass, filter, getDescription, getTestClass, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses
public BlockJUnit4ClassRunnerWithParameters(TestWithParameters test) throws InitializationError
InitializationError
public Object createTest() throws Exception
BlockJUnit4ClassRunner
createTest
in class BlockJUnit4ClassRunner
Exception
protected String getName()
ParentRunner
getName
in class ParentRunner<FrameworkMethod>
protected String testName(FrameworkMethod method)
BlockJUnit4ClassRunner
method
for Description
s.
Default implementation is the method's nametestName
in class BlockJUnit4ClassRunner
protected void validateConstructor(List<Throwable> errors)
BlockJUnit4ClassRunner
errors
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 BlockJUnit4ClassRunner
protected void validateFields(List<Throwable> errors)
validateFields
in class BlockJUnit4ClassRunner
protected Statement classBlock(RunNotifier notifier)
ParentRunner
Statement
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).ClassRule
s 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>
Statement
protected Annotation[] getRunnerAnnotations()
getRunnerAnnotations
in class ParentRunner<FrameworkMethod>
Copyright © 2002–2015 JUnit. All rights reserved.