类 BlockJUnit4ClassRunnerWithParameters
- java.lang.Object
- org.junit.runner.Runner
- org.junit.runners.ParentRunner<FrameworkMethod>
- org.junit.runners.BlockJUnit4ClassRunner
- org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters
- 所有已实现的接口:
Describable
,Filterable
,Sortable
public class BlockJUnit4ClassRunnerWithParameters extends BlockJUnit4ClassRunner
ABlockJUnit4ClassRunner
with parameters support. Parameters can be injected via constructor or into annotated fields.
构造器概要
构造器 构造器 说明 BlockJUnit4ClassRunnerWithParameters(TestWithParameters test)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected Statement
classBlock(RunNotifier notifier)
Constructs aStatement
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 Runnerprotected Annotation[]
getRunnerAnnotations()
protected String
testName(FrameworkMethod method)
Returns the name that describesmethod
forDescription
s.protected void
validateConstructor(List<Throwable> errors)
Adds toerrors
if the test class has more than one constructor, or if the constructor takes parameters.protected void
validateFields(List<Throwable> errors)
从类继承的方法 org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
从类继承的方法 org.junit.runners.ParentRunner
childrenInvoker, classRules, createTestClass, filter, getDescription, getTestClass, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses
构造器详细资料
BlockJUnit4ClassRunnerWithParameters
public BlockJUnit4ClassRunnerWithParameters(TestWithParameters test) throws InitializationError
方法详细资料
createTest
public Object createTest() throws Exception
从类复制的说明:BlockJUnit4ClassRunner
Returns a new fixture for running a test. Default implementation executes the test class's no-argument constructor (validation should have ensured one exists).- 覆盖:
createTest
在类中BlockJUnit4ClassRunner
- 抛出:
Exception
getName
protected String getName()
从类复制的说明:ParentRunner
Returns a name used to describe this Runner- 覆盖:
getName
在类中ParentRunner<FrameworkMethod>
testName
protected String testName(FrameworkMethod method)
从类复制的说明:BlockJUnit4ClassRunner
Returns the name that describesmethod
forDescription
s. Default implementation is the method's name- 覆盖:
testName
在类中BlockJUnit4ClassRunner
validateConstructor
protected void validateConstructor(List<Throwable> errors)
从类复制的说明:BlockJUnit4ClassRunner
Adds toerrors
if the test class has more than one constructor, or if the constructor takes parameters. Override if a subclass requires different validation rules.
validateFields
protected void validateFields(List<Throwable> errors)
classBlock
protected Statement classBlock(RunNotifier notifier)
从类复制的说明:ParentRunner
Constructs aStatement
to run all of the tests in the test class. Override to add pre-/post-processing. Here is an outline of the implementation:- Determine the children to be run using
ParentRunner.getChildren()
(subject to any imposed filter and sort). - If there are any children remaining after filtering and ignoring, construct a statement that will:
- Apply all
ClassRule
s on the test-class and superclasses. - Run all non-overridden
@BeforeClass
methods on the test-class and superclasses; if any throws an Exception, stop execution and pass the exception on. - Run all remaining tests on the test-class.
- Run all non-overridden
@AfterClass
methods on the test-class and superclasses: exceptions thrown by previous steps are combined, if necessary, with exceptions from AfterClass methods into aMultipleFailureException
.
- Apply all
- 覆盖:
classBlock
在类中ParentRunner<FrameworkMethod>
- 返回:
Statement
- Determine the children to be run using
getRunnerAnnotations
protected Annotation[] getRunnerAnnotations()
- 覆盖:
getRunnerAnnotations
在类中ParentRunner<FrameworkMethod>
- 返回:
- the annotations that should be attached to this runner's description.