Closed protocol7 closed 2 months ago
@Test void mockitoStatic() { rewriteRun( spec -> spec.recipe(new PowerMockitoMockStaticToMockito()), java( """ package com.helloworld; import static org.mockito.Mockito.mockStatic; import org.mockito.MockedStatic; public class Main { private final MockedStatic<String> mocked = mockStatic(String.class); }""")); }
Test fails due to the recipe removing = mockStatic(String.class), which causes compilation failure due to mocked never being initialised.
= mockStatic(String.class)
mocked
Hey @protocol7!
Thanks for the provided test case! I took a look at it, confirmed the issue and proposed a change
Thanks!
What version of OpenRewrite are you using?
What is the smallest, simplest way to reproduce the problem?
Test fails due to the recipe removing
= mockStatic(String.class)
, which causes compilation failure due tomocked
never being initialised.