Mockito best practices
MSALApplies best practices for Mockito tests.
org. openrewrite. java. testing. mockito. MockitoBestPracticesmod run . --recipe= org. openrewrite. java. testing. mockito. MockitoBestPracticesInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Upgrade to Mockito 5.x
- Remove annotation
@org.mockito.junit.jupiter.MockitoSettings(strictness=org.mockito.quality.Strictness.WARN) - Remove
Mockito.times(0)andMockito.times(1) - Remove
doNothing()for void methods on@Mockfields - Remove
eq()matchers from Mockitoverify,whenandgivencalls - Wrap
MockedConstructionin try-with-resources