Class SpringIntegrationMethodRule
java.lang.Object
net.serenitybdd.junit.spring.integration.SpringIntegrationMethodRule
- All Implemented Interfaces:
org.junit.rules.MethodRule
A
TestRule
to be used with @Rule
to run the @Before and @After 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.runners.model.FrameworkMethod frameworkMethod, Object target) WrapsRunBeforeTestMethodCallbacks
andRunAfterTestMethodCallbacks
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
-
SpringIntegrationMethodRule
public SpringIntegrationMethodRule()
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod frameworkMethod, Object target) WrapsRunBeforeTestMethodCallbacks
andRunAfterTestMethodCallbacks
around the provided statement.- Specified by:
apply
in interfaceorg.junit.rules.MethodRule
- Parameters:
base
- The base statementframeworkMethod
- Information about the test method being run.target
- The instance of 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.
-