MockitoAnnotations.initMocks is now deprecated. New MockitoSession - mockito-core 3.8.0 javadoc can be used instead.
Link to documentation of *Mockito 2.x - which is old one.
There is new version 3.x - mockito-core 3.8.0 javadoc (org.mockito)
There is MockitoTestNGListener - mockito-testng 0.2.10 javadoc for TestNG
Maybe it is not a bug but improvement, I think that new rule should refer to the latest version of library.
Hello @slawekjaranowski,
Thanks for the report
Let’s address the issues in order:
-
RSPEC-5979 supports both the deprecated
initMocks and the newer openMocks. While I get the point about discouraging the use of deprecated APIs, IDEs and other sonar rules do a good job of signaling this. But maybe we can change the documentation rule so that initMocks does not benefit from the free publicity.
-
MockitoSession is not currently supported by the rule but a ticket has been created to handle the issue
- Links are indeed pointing to outdated documentation and will be updated
- TestNG annotations are not currently covered by the rule but a ticket has been created to handle the issue
Cheers and thanks for the feedback.
Dorian