public class SpringifiedConcordionRunner
extends org.concordion.integration.junit4.ConcordionRunner
ConcordionRunner which runs concordion tests in the context of a spring container. Most of
the code were taken from SpringJUnit4ClassRunner which concerns initializing fixture instances using TestContextManager#prepareTestInstance and hooking the TestContextManager to JUnit's test phases.| Constructor and Description |
|---|
SpringifiedConcordionRunner(java.lang.Class<?> clazz)
Creates a BlockJUnit4ClassRunner to run
klass |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
createTest()
Delegate to the parent implementation for creating the test instance and then allow the
TestContextManager to prepare the test instance before returning it. |
protected org.springframework.test.context.TestContextManager |
createTestContextManager(java.lang.Class<?> clazz)
Create a new
TestContextManager for the supplied test class. |
org.junit.runner.Description |
getDescription()
Return a description suitable for an ignored test class if the test is disabled via
@IfProfileValue at
the class-level, and otherwise delegate to the parent implementation. |
protected org.springframework.test.context.TestContextManager |
getTestContextManager()
Get the
TestContextManager associated with this runner. |
protected boolean |
isTestMethodIgnored(org.junit.runners.model.FrameworkMethod frameworkMethod)
Return
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 |
methodBlock(org.junit.runners.model.FrameworkMethod frameworkMethod)
Similar to how SpringJUnit4ClassRunner has augmented BlockJUnit4ClassRunner except the callbacks relating to
timeout and repeat because FrameworkMethods in Concordion are not possible to be annotated.
|
void |
run(org.junit.runner.notification.RunNotifier notifier)
Check whether the test is enabled in the current execution environment.
|
protected void |
runChild(org.junit.runners.model.FrameworkMethod frameworkMethod,
org.junit.runner.notification.RunNotifier notifier)
Perform the same logic as
BlockJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier), except that
tests are determined to be ignored by isTestMethodIgnored(FrameworkMethod). |
protected org.junit.runners.model.Statement |
withAfterClasses(org.junit.runners.model.Statement statement)
Wrap the
Statement returned by the parent implementation with a RunAfterTestClassCallbacks
statement, thus preserving the default JUnit functionality while adding support for the Spring TestContext
Framework. |
protected org.junit.runners.model.Statement |
withAfters(org.junit.runners.model.FrameworkMethod frameworkMethod,
java.lang.Object testInstance,
org.junit.runners.model.Statement statement)
Wrap the
Statement returned by the parent implementation with a RunAfterTestMethodCallbacks
statement, thus preserving the default functionality while adding support for the Spring TestContext Framework. |
protected org.junit.runners.model.Statement |
withAfterTestExecutionCallbacks(org.junit.runners.model.FrameworkMethod frameworkMethod,
java.lang.Object testInstance,
org.junit.runners.model.Statement statement)
Wrap the supplied
Statement with a RunAfterTestExecutionCallbacks statement, thus preserving the
default functionality while adding support for the Spring TestContext Framework. |
protected org.junit.runners.model.Statement |
withBeforeClasses(org.junit.runners.model.Statement statement)
Wrap the
Statement returned by the parent implementation with a RunBeforeTestClassCallbacks
statement, thus preserving the default JUnit functionality while adding support for the Spring TestContext
Framework. |
protected org.junit.runners.model.Statement |
withBefores(org.junit.runners.model.FrameworkMethod frameworkMethod,
java.lang.Object testInstance,
org.junit.runners.model.Statement statement)
Wrap the
Statement returned by the parent implementation with a RunBeforeTestMethodCallbacks
statement, thus preserving the default functionality while adding support for the Spring TestContext Framework. |
protected org.junit.runners.model.Statement |
withBeforeTestExecutionCallbacks(org.junit.runners.model.FrameworkMethod frameworkMethod,
java.lang.Object testInstance,
org.junit.runners.model.Statement statement)
Wrap the supplied
Statement with a RunBeforeTestExecutionCallbacks statement, thus preserving the
default functionality while adding support for the Spring TestContext Framework. |
createFixture, describeChild, getChildren, getSpecificationLocator, validateInstanceMethodscollectInitializationErrors, computeTestMethods, getTestRules, isIgnored, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withPotentialTimeoutpublic SpringifiedConcordionRunner(java.lang.Class<?> clazz)
throws org.junit.runners.model.InitializationError
klassclazz - the fixture classorg.junit.runners.model.InitializationError - if the test class is malformed.protected org.springframework.test.context.TestContextManager createTestContextManager(java.lang.Class<?> clazz)
TestContextManager for the supplied test class.
Can be overridden by subclasses.
clazz - the test class to be managedprotected final org.springframework.test.context.TestContextManager getTestContextManager()
TestContextManager associated with this runner.public org.junit.runner.Description getDescription()
@IfProfileValue at
the class-level, and otherwise delegate 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)
This prevents classes with a non-matching @IfProfileValue
annotation from running altogether, even skipping the execution of prepareTestInstance() methods in
TestExecutionListeners.
run in class org.concordion.integration.junit4.ConcordionRunnerProfileValueUtils.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 JUnit functionality while 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 JUnit functionality while adding support for the Spring TestContext
Framework.withAfterClasses in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>RunAfterTestClassCallbacksprotected java.lang.Object createTest()
throws java.lang.Exception
TestContextManager to prepare the test instance before returning it.createTest in class org.concordion.integration.junit4.ConcordionRunnerjava.lang.ExceptionTestContextManager.prepareTestInstance(java.lang.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.concordion.integration.junit4.ConcordionRunnerprotected org.junit.runners.model.Statement methodBlock(org.junit.runners.model.FrameworkMethod frameworkMethod)
methodBlock in class org.junit.runners.BlockJUnit4ClassRunnerBlockJUnit4ClassRunner.methodInvoker(FrameworkMethod, Object),
withBeforeTestExecutionCallbacks(FrameworkMethod, Object, Statement),
withAfterTestExecutionCallbacks(FrameworkMethod, Object, Statement),
BlockJUnit4ClassRunner.possiblyExpectingExceptions(FrameworkMethod, Object, Statement),
withBefores(FrameworkMethod, Object, Statement),
withAfters(FrameworkMethod, Object, Statement),
withRulesReflectively(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.ProfileValueUtils.isTestEnabledInThisEnvironment(Method, Class)protected org.junit.runners.model.Statement withBeforeTestExecutionCallbacks(org.junit.runners.model.FrameworkMethod frameworkMethod,
java.lang.Object testInstance,
org.junit.runners.model.Statement statement)
Statement with a RunBeforeTestExecutionCallbacks statement, thus preserving the
default functionality while adding support for the Spring TestContext Framework.RunBeforeTestExecutionCallbacksprotected org.junit.runners.model.Statement withAfterTestExecutionCallbacks(org.junit.runners.model.FrameworkMethod frameworkMethod,
java.lang.Object testInstance,
org.junit.runners.model.Statement statement)
Statement with a RunAfterTestExecutionCallbacks statement, thus preserving the
default functionality while adding support for the Spring TestContext Framework.RunAfterTestExecutionCallbacksprotected org.junit.runners.model.Statement withBefores(org.junit.runners.model.FrameworkMethod frameworkMethod,
java.lang.Object testInstance,
org.junit.runners.model.Statement statement)
Statement returned by the parent implementation with a RunBeforeTestMethodCallbacks
statement, thus preserving the default functionality while 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,
java.lang.Object testInstance,
org.junit.runners.model.Statement statement)
Statement returned by the parent implementation with a RunAfterTestMethodCallbacks
statement, thus preserving the default functionality while adding support for the Spring TestContext Framework.withAfters in class org.junit.runners.BlockJUnit4ClassRunnerRunAfterTestMethodCallbacks