public class MockitoTestExecutionListener
extends org.springframework.test.context.support.AbstractTestExecutionListener
TestExecutionListener to enable @MockBean and
@SpyBean support. Also triggers
MockitoAnnotations.openMocks(Object) when any Mockito annotations used,
primarily to allow @Captor annotations.
To use the automatic reset support of @MockBean and @SpyBean, configure
ResetMocksTestExecutionListener as well.
ResetMocksTestExecutionListener| Constructor and Description |
|---|
MockitoTestExecutionListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterTestMethod(org.springframework.test.context.TestContext testContext) |
void |
beforeTestMethod(org.springframework.test.context.TestContext testContext) |
int |
getOrder() |
void |
prepareTestInstance(org.springframework.test.context.TestContext testContext) |
public final int getOrder()
getOrder in interface org.springframework.core.OrderedgetOrder in class org.springframework.test.context.support.AbstractTestExecutionListenerpublic void prepareTestInstance(org.springframework.test.context.TestContext testContext)
throws java.lang.Exception
prepareTestInstance in interface org.springframework.test.context.TestExecutionListenerprepareTestInstance in class org.springframework.test.context.support.AbstractTestExecutionListenerjava.lang.Exceptionpublic void beforeTestMethod(org.springframework.test.context.TestContext testContext)
throws java.lang.Exception
beforeTestMethod in interface org.springframework.test.context.TestExecutionListenerbeforeTestMethod in class org.springframework.test.context.support.AbstractTestExecutionListenerjava.lang.Exceptionpublic void afterTestMethod(org.springframework.test.context.TestContext testContext)
throws java.lang.Exception
afterTestMethod in interface org.springframework.test.context.TestExecutionListenerafterTestMethod in class org.springframework.test.context.support.AbstractTestExecutionListenerjava.lang.Exception