Objects annotated with Mockito annotations ``++@Mock++``,``++@Spy++``,``++@Captor++``,or ``++@InjectMocks++`` need to be initialized explicitly.
There are several ways to do this:
* Call ``++MockitoAnnotations.openMocks(this)++`` or``++MockitoAnnotations.initMocks(this)++``in a setup method
* Annotate test class with``++@RunWith(MockitoJUnitRunner.class)++``(JUnit 4)
* Annotate test class with``++@ExtendWith(MockitoExtension.class)++``(JUnit 5 Jupiter)
* Use``++@Rule public MockitoRule rule = MockitoJUnit.rule();++``
Test using uninitialized mocks will fail.
Note that this only applies to annotated Mockito objects. It is not necessary to initialize objects instantiated via ``++Mockito.mock()++`` or ``++Mockito.spy()++``.
This rule raises an issue when a test class uses uninitialized mocks.