Class SpringIntegrationClassRule
java.lang.Object
net.serenitybdd.junit.spring.integration.SpringIntegrationClassRule
- All Implemented Interfaces:
org.junit.rules.TestRule
A
TestRule
to be used with @ClassRule
to run the @BeforeClass and @AfterClass modifiers that are part of SpringJUnit4ClassRunner
.- Author:
- [email protected]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement next, Class<?> testClass, Object testInstance, net.serenitybdd.junit.spring.integration.SpringIntegrationRuleBase.StatementWrapper beforeWrapper, net.serenitybdd.junit.spring.integration.SpringIntegrationRuleBase.StatementWrapper afterWrapper) Wraps a before and after statement around the supplied statement, possibly preparing the test instance first.org.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) WrapsRunBeforeTestClassCallbacks
andRunAfterTestClassCallbacks
around the provided statement.static org.springframework.test.context.TestContextManager
createTestContextManager
(Class<?> testClass) Creates a test context manager.org.springframework.test.context.TestContextManager
getTestContextManager
(Class<?> testClass) Gets the test context manager, creating it if it doesn't exist.
-
Constructor Details
-
SpringIntegrationClassRule
public SpringIntegrationClassRule()
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) WrapsRunBeforeTestClassCallbacks
andRunAfterTestClassCallbacks
around the provided statement.- Specified by:
apply
in interfaceorg.junit.rules.TestRule
- Parameters:
base
- The base statementdescription
- Information about the test class being run.- Returns:
- The wrapped statement.
-
createTestContextManager
public static org.springframework.test.context.TestContextManager createTestContextManager(Class<?> testClass) Creates a test context manager.- Parameters:
testClass
- The test class to create the test context manager for.- Returns:
- The new test context manager.
-
getTestContextManager
public org.springframework.test.context.TestContextManager getTestContextManager(Class<?> testClass) Gets the test context manager, creating it if it doesn't exist.- Parameters:
testClass
- The test class to create the test context manager for, if it doesn't exist.- Returns:
- The test context manager.
-
apply
protected org.junit.runners.model.Statement apply(org.junit.runners.model.Statement next, Class<?> testClass, Object testInstance, net.serenitybdd.junit.spring.integration.SpringIntegrationRuleBase.StatementWrapper beforeWrapper, net.serenitybdd.junit.spring.integration.SpringIntegrationRuleBase.StatementWrapper afterWrapper) Wraps a before and after statement around the supplied statement, possibly preparing the test instance first.- Parameters:
next
- The next statement.testClass
- The class being tested.testInstance
- The instance of the class being tested.beforeWrapper
- The before wrapper.afterWrapper
- The after wrapper.- Returns:
- The new, wrapped statement.
-