public class SpringJUnit4ClassRunner
extends org.junit.runners.BlockJUnit4ClassRunner
 SpringJUnit4ClassRunner is a custom extension of
 BlockJUnit4ClassRunner which provides functionality of the
 Spring TestContext Framework to standard JUnit 4.5+ tests by means
 of the TestContextManager and associated support classes and
 annotations.
 
 The following list constitutes all annotations currently supported directly
 by SpringJUnit4ClassRunner.
 (Note that additional annotations may be supported by various
 TestExecutionListeners)
 
@Test(expected=...)@ExpectedException@Test(timeout=...)@Timed@Repeat@Ignore@ProfileValueSourceConfiguration@IfProfileValue
 NOTE: As of Spring 3.0, SpringJUnit4ClassRunner requires
 JUnit 4.5+.
 
TestContextManager| Constructor and Description | 
|---|
| SpringJUnit4ClassRunner(Class<?> clazz)Constructs a new  SpringJUnit4ClassRunnerand initializes aTestContextManagerto provide Spring testing functionality to
 standard JUnit tests. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected Object | createTest()Delegates to the parent implementation for creating the test instance and
 then allows the  TestContextManagerto
 prepare the test instance before returning it. | 
| protected TestContextManager | createTestContextManager(Class<?> clazz)Creates a new  TestContextManagerfor the supplied test class and
 the configured defaultContextLoaderclass name. | 
| protected String | getDefaultContextLoaderClassName(Class<?> clazz)Get the name of the default  ContextLoaderclass to use for
 the supplied test class. | 
| org.junit.runner.Description | getDescription()Returns a description suitable for an ignored test class if the test is
 disabled via  @IfProfileValueat the class-level, and
 otherwise delegates to the parent implementation. | 
| protected Class<? extends Throwable> | getExpectedException(org.junit.runners.model.FrameworkMethod frameworkMethod)Get the  exceptionthat the suppliedtest methodis expected to throw. | 
| protected long | getJUnitTimeout(org.junit.runners.model.FrameworkMethod frameworkMethod)Retrieves the configured JUnit  timeoutfrom the@Testannotation on the suppliedtest method. | 
| protected long | getSpringTimeout(org.junit.runners.model.FrameworkMethod frameworkMethod)Retrieves the configured Spring-specific  timeoutfrom the@Timedannotation on the suppliedtest method. | 
| protected TestContextManager | getTestContextManager()Get the  TestContextManagerassociated with this runner. | 
| protected boolean | isTestMethodIgnored(org.junit.runners.model.FrameworkMethod frameworkMethod)Returns  trueif@Ignoreis present for
 the suppliedtest methodor if the test method is
 disabled via@IfProfileValue. | 
| protected org.junit.runners.model.Statement | methodBlock(org.junit.runners.model.FrameworkMethod frameworkMethod)Augments the default JUnit behavior
  with
 potential repeatsof the entire execution chain. | 
| protected org.junit.runners.model.Statement | possiblyExpectingExceptions(org.junit.runners.model.FrameworkMethod frameworkMethod,
                           Object testInstance,
                           org.junit.runners.model.Statement next)Performs the same logic as
  BlockJUnit4ClassRunner.possiblyExpectingExceptions(FrameworkMethod, Object, Statement)except that the expected exception is retrieved usinggetExpectedException(FrameworkMethod). | 
| void | run(org.junit.runner.notification.RunNotifier notifier)Check whether the test is enabled in the first place. | 
| protected void | runChild(org.junit.runners.model.FrameworkMethod frameworkMethod,
        org.junit.runner.notification.RunNotifier notifier)Performs the same logic as
  BlockJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier),
 except that tests are determined to be ignored byisTestMethodIgnored(FrameworkMethod). | 
| protected org.junit.runners.model.Statement | withAfterClasses(org.junit.runners.model.Statement statement)Wraps the  Statementreturned by the parent implementation with aRunAfterTestClassCallbacksstatement, thus preserving the default
 functionality but adding support for the Spring TestContext Framework. | 
| protected org.junit.runners.model.Statement | withAfters(org.junit.runners.model.FrameworkMethod frameworkMethod,
          Object testInstance,
          org.junit.runners.model.Statement statement)Wraps the  Statementreturned by the parent implementation with aRunAfterTestMethodCallbacksstatement, thus preserving the
 default functionality but adding support for the Spring TestContext
 Framework. | 
| protected org.junit.runners.model.Statement | withBeforeClasses(org.junit.runners.model.Statement statement)Wraps the  Statementreturned by the parent implementation with aRunBeforeTestClassCallbacksstatement, thus preserving the
 default functionality but adding support for the Spring TestContext
 Framework. | 
| protected org.junit.runners.model.Statement | withBefores(org.junit.runners.model.FrameworkMethod frameworkMethod,
           Object testInstance,
           org.junit.runners.model.Statement statement)Wraps the  Statementreturned by the parent implementation with aRunBeforeTestMethodCallbacksstatement, thus preserving the
 default functionality but adding support for the Spring TestContext
 Framework. | 
| protected org.junit.runners.model.Statement | withPotentialRepeat(org.junit.runners.model.FrameworkMethod frameworkMethod,
                   Object testInstance,
                   org.junit.runners.model.Statement next)Supports Spring's  @Repeatannotation by returning aSpringRepeatstatement initialized with the configured repeat
 count or1if no repeat count is configured. | 
| protected org.junit.runners.model.Statement | withPotentialTimeout(org.junit.runners.model.FrameworkMethod frameworkMethod,
                    Object testInstance,
                    org.junit.runners.model.Statement next)Supports both Spring's  @Timedand JUnit's@Test(timeout=...)annotations, but not both
 simultaneously. | 
collectInitializationErrors, computeTestMethods, describeChild, getChildren, getTestRules, methodInvoker, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructorpublic SpringJUnit4ClassRunner(Class<?> clazz) throws org.junit.runners.model.InitializationError
SpringJUnit4ClassRunner and initializes a
 TestContextManager to provide Spring testing functionality to
 standard JUnit tests.clazz - the test class to be runorg.junit.runners.model.InitializationErrorcreateTestContextManager(Class)protected TestContextManager createTestContextManager(Class<?> clazz)
TestContextManager for the supplied test class and
 the configured default ContextLoader class name.
 Can be overridden by subclasses.clazz - the test class to be managedgetDefaultContextLoaderClassName(Class)protected final TestContextManager getTestContextManager()
TestContextManager associated with this runner.protected String getDefaultContextLoaderClassName(Class<?> clazz)
ContextLoader class to use for
 the supplied test class. The named class will be used if the test class
 does not explicitly declare a ContextLoader class via the
 @ContextConfiguration annotation.
 The default implementation returns null, thus implying use
 of the standard default ContextLoader class name.
 Can be overridden by subclasses.
clazz - the test classnullpublic org.junit.runner.Description getDescription()
@IfProfileValue at the class-level, and
 otherwise delegates to the parent implementation.getDescription in interface org.junit.runner.DescribablegetDescription in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>ProfileValueUtils.isTestEnabledInThisEnvironment(Class)public void run(org.junit.runner.notification.RunNotifier notifier)
@IfProfileValue annotation
 from running altogether, even skipping the execution of
 prepareTestInstance() TestExecutionListener
 methods.run in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>ProfileValueUtils.isTestEnabledInThisEnvironment(Class), 
IfProfileValue, 
TestExecutionListenerprotected org.junit.runners.model.Statement withBeforeClasses(org.junit.runners.model.Statement statement)
Statement returned by the parent implementation with a
 RunBeforeTestClassCallbacks statement, thus preserving the
 default functionality but adding support for the Spring TestContext
 Framework.withBeforeClasses in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>RunBeforeTestClassCallbacksprotected org.junit.runners.model.Statement withAfterClasses(org.junit.runners.model.Statement statement)
Statement returned by the parent implementation with a
 RunAfterTestClassCallbacks statement, thus preserving the default
 functionality but adding support for the Spring TestContext Framework.withAfterClasses in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>RunAfterTestClassCallbacksprotected Object createTest() throws Exception
TestContextManager to
 prepare the test instance before returning it.createTest in class org.junit.runners.BlockJUnit4ClassRunnerExceptionTestContextManager.prepareTestInstance(Object)protected void runChild(org.junit.runners.model.FrameworkMethod frameworkMethod,
            org.junit.runner.notification.RunNotifier notifier)
BlockJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier),
 except that tests are determined to be ignored by
 isTestMethodIgnored(FrameworkMethod).runChild in class org.junit.runners.BlockJUnit4ClassRunnerprotected org.junit.runners.model.Statement methodBlock(org.junit.runners.model.FrameworkMethod frameworkMethod)
with
 potential repeats of the entire execution chain.
 Furthermore, support for timeouts has been moved down the execution chain
 in order to include execution of @Before
 and @After methods within the timed
 execution. Note that this differs from the default JUnit behavior of
 executing @Before and @After methods
 in the main thread while executing the actual test method in a separate
 thread. Thus, the end effect is that @Before and
 @After methods will be executed in the same thread as
 the test method. As a consequence, JUnit-specified timeouts will work
 fine in combination with Spring transactions. Note that JUnit-specific
 timeouts still differ from Spring-specific timeouts in that the former
 execute in a separate thread while the latter simply execute in the main
 thread (like regular tests).
methodBlock in class org.junit.runners.BlockJUnit4ClassRunnerpossiblyExpectingExceptions(FrameworkMethod, Object, Statement), 
withBefores(FrameworkMethod, Object, Statement), 
withAfters(FrameworkMethod, Object, Statement), 
withPotentialTimeout(FrameworkMethod, Object, Statement), 
withPotentialRepeat(FrameworkMethod, Object, Statement)protected boolean isTestMethodIgnored(org.junit.runners.model.FrameworkMethod frameworkMethod)
true if @Ignore is present for
 the supplied test method or if the test method is
 disabled via @IfProfileValue.protected org.junit.runners.model.Statement possiblyExpectingExceptions(org.junit.runners.model.FrameworkMethod frameworkMethod,
                                                            Object testInstance,
                                                            org.junit.runners.model.Statement next)
BlockJUnit4ClassRunner.possiblyExpectingExceptions(FrameworkMethod, Object, Statement)
 except that the expected exception is retrieved using
 getExpectedException(FrameworkMethod).possiblyExpectingExceptions in class org.junit.runners.BlockJUnit4ClassRunnerprotected Class<? extends Throwable> getExpectedException(org.junit.runners.model.FrameworkMethod frameworkMethod)
exception that the supplied test method is expected to throw.
 Supports both Spring's @ExpectedException(...)
 and JUnit's @Test(expected=...) annotations, but
 not both simultaneously.
null if none was specifiedprotected org.junit.runners.model.Statement withPotentialTimeout(org.junit.runners.model.FrameworkMethod frameworkMethod,
                                                     Object testInstance,
                                                     org.junit.runners.model.Statement next)
@Timed and JUnit's
 @Test(timeout=...) annotations, but not both
 simultaneously. Returns either a SpringFailOnTimeout, a
 FailOnTimeout, or the unmodified, supplied Statement as
 appropriate.withPotentialTimeout in class org.junit.runners.BlockJUnit4ClassRunnergetSpringTimeout(FrameworkMethod), 
getJUnitTimeout(FrameworkMethod)protected long getJUnitTimeout(org.junit.runners.model.FrameworkMethod frameworkMethod)
timeout from the @Test annotation on the supplied test method.0 if none was specified.protected long getSpringTimeout(org.junit.runners.model.FrameworkMethod frameworkMethod)
timeout from the
 @Timed annotation on the supplied
 test method.0 if none was specified.protected org.junit.runners.model.Statement withBefores(org.junit.runners.model.FrameworkMethod frameworkMethod,
                                            Object testInstance,
                                            org.junit.runners.model.Statement statement)
Statement returned by the parent implementation with a
 RunBeforeTestMethodCallbacks statement, thus preserving the
 default functionality but adding support for the Spring TestContext
 Framework.withBefores in class org.junit.runners.BlockJUnit4ClassRunnerRunBeforeTestMethodCallbacksprotected org.junit.runners.model.Statement withAfters(org.junit.runners.model.FrameworkMethod frameworkMethod,
                                           Object testInstance,
                                           org.junit.runners.model.Statement statement)
Statement returned by the parent implementation with a
 RunAfterTestMethodCallbacks statement, thus preserving the
 default functionality but adding support for the Spring TestContext
 Framework.withAfters in class org.junit.runners.BlockJUnit4ClassRunnerRunAfterTestMethodCallbacksprotected org.junit.runners.model.Statement withPotentialRepeat(org.junit.runners.model.FrameworkMethod frameworkMethod,
                                                    Object testInstance,
                                                    org.junit.runners.model.Statement next)
@Repeat annotation by returning a
 SpringRepeat statement initialized with the configured repeat
 count or 1 if no repeat count is configured.SpringRepeat