MockitoExtension
MockitoExtension is a JUnit 5 extension that integrates the Mockito mocking framework with the Jupiter test platform. It provides automatic mock initialization and supports injection of mocks into the class under test, reducing boilerplate in test setup. The extension is part of the Mockito library and is located in the org.mockito.junit.jupiter package.
Usage typically involves annotating a test class with @ExtendWith(MockitoExtension.class) and marking fields with Mockito annotations such
MockitoExtension supports several features aimed at improving test reliability, including strict stubbing by default, which helps
Compared with JUnit 4 approaches like MockitoJUnitRunner or MockitoAnnotations, MockitoExtension offers native support for JUnit 5