Upgrade to Mockito 4.x
MSALUpgrade Mockito from 1.x to 4.x.
org. openrewrite. java. testing. mockito. Mockito1to4Migrationmod run . --recipe= org. openrewrite. java. testing. mockito. Mockito1to4MigrationInstall 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 Mockito from 1.x to 3.x
- Replace
Mockito.whenon static (non mock) with try-with-resource with MockedStatic - Upgrade Gradle or Maven dependency versions
org.mockito:*:4.x - Change Gradle or Maven dependency
org.mockito:mockito-all - Upgrade Gradle or Maven dependency versions
net.bytebuddy:byte-buddy*:1.12.19 - Upgrade Byte Buddy along with Mockito 4
- Replace
MockitoAnnotations.initMocks(this)toMockitoAnnotations.openMocks(this) - Close unclosed static mocks