Close unclosed static mocks

MSAL

Ensures that all mockStatic calls are properly closed. If mockStatic is in lifecycle methods like @BeforeEach or @BeforeAll, creates a class variable and closes it in @AfterEach or @AfterAll. If mockStatic is inside a test method, wraps it in a try-with-resources block.

org.openrewrite.java.testing.mockito.CloseUnclosedStaticMocks
mod run . --recipe=org.openrewrite.java.testing.mockito.CloseUnclosedStaticMocks

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.