Class MockitoTestExecutionListener
java.lang.Object
org.springframework.test.context.support.AbstractTestExecutionListener
org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener
- All Implemented Interfaces:
Ordered
,TestExecutionListener
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.
- Since:
- 1.4.2
- Author:
- Phillip Webb, Andy Wilkinson
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterTestMethod
(TestContext testContext) void
beforeTestMethod
(TestContext testContext) final int
getOrder()
void
prepareTestInstance
(TestContext testContext) Methods inherited from class org.springframework.test.context.support.AbstractTestExecutionListener
afterTestClass, afterTestExecution, beforeTestClass, beforeTestExecution
-
Constructor Details
-
MockitoTestExecutionListener
public MockitoTestExecutionListener()
-
-
Method Details
-
getOrder
public final int getOrder()- Specified by:
getOrder
in interfaceOrdered
- Overrides:
getOrder
in classAbstractTestExecutionListener
-
prepareTestInstance
- Specified by:
prepareTestInstance
in interfaceTestExecutionListener
- Overrides:
prepareTestInstance
in classAbstractTestExecutionListener
- Throws:
Exception
-
beforeTestMethod
- Specified by:
beforeTestMethod
in interfaceTestExecutionListener
- Overrides:
beforeTestMethod
in classAbstractTestExecutionListener
- Throws:
Exception
-
afterTestMethod
- Specified by:
afterTestMethod
in interfaceTestExecutionListener
- Overrides:
afterTestMethod
in classAbstractTestExecutionListener
- Throws:
Exception
-