Class MockitoTestExecutionListener

java.lang.Object
org.springframework.test.context.support.AbstractTestExecutionListener
org.springframework.test.context.bean.override.mockito.MockitoTestExecutionListener
All Implemented Interfaces:
Ordered, TestExecutionListener

public class MockitoTestExecutionListener extends AbstractTestExecutionListener
TestExecutionListener that enables @MockitoBean and @MockitoSpyBean support. Also triggers Mockito setup of a session for each test class that uses these annotations (or any annotation in that package).

The strictness of the session defaults to Strictness.STRICT_STUBS. Use MockitoBeanSettings to specify a different strictness.

The automatic reset support for @MockBean and @SpyBean is handled by the MockitoResetTestExecutionListener.

Since:
6.2
Author:
Simon Baslé, Phillip Webb, Andy Wilkinson, Moritz Halbritter
See Also: