You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The org.mockito..* clause means any test file that imports something from org.mockito.* qualifies — including files with no PowerMockito anywhere. Since the recipe is registered transitively under MockitoBestPractices → Mockito1to5Migration → Mockito1to4Migration → Mockito1to3Migration, every Mockito-only test ends up running PowerMockito-to-Mockito conversion logic. That's how we hit Preserve mockStatic when returned from helper methods #979 (helper returning mockStatic(...)) on a project with no PowerMockito at all.
(The second clause is redundant under the first, but spelling it out makes intent clear if someone later relaxes the wildcard.)
Risk
Tightening the precondition will skip files that don't import PowerMockito but happened to be "fixed up" by this recipe's other branches (e.g. the bare-mockStatic removal, the dynamic-when rewrite). Need to audit which of those branches are useful for non-PowerMockito files and either move them to a separate recipe or accept the scope reduction.
Problem
PowerMockitoMockStaticToMockito's precondition is currently:org.mockito..*clause means any test file that imports something fromorg.mockito.*qualifies — including files with no PowerMockito anywhere. Since the recipe is registered transitively underMockitoBestPractices→Mockito1to5Migration→Mockito1to4Migration→Mockito1to3Migration, every Mockito-only test ends up running PowerMockito-to-Mockito conversion logic. That's how we hit Preserve mockStatic when returned from helper methods #979 (helper returningmockStatic(...)) on a project with no PowerMockito at all.Suggested fix
Restrict to actual PowerMockito signal:
(The second clause is redundant under the first, but spelling it out makes intent clear if someone later relaxes the wildcard.)
Risk
Tightening the precondition will skip files that don't import PowerMockito but happened to be "fixed up" by this recipe's other branches (e.g. the bare-mockStatic removal, the dynamic-when rewrite). Need to audit which of those branches are useful for non-PowerMockito files and either move them to a separate recipe or accept the scope reduction.
Related
J.Returngetting nullified)