rewrite-testing-frameworks
rewrite-testing-frameworks copied to clipboard
PowerMockito `doThrow(Throwable).when(Class, String, any())` not converted to Mockito single argument `when`
I am using
Is your project a single module or a multi-module project? Yes
Can you share your configuration so that we can rule out any configuration issues?
Is your project public? If so, can you share a link to it? no
Hi @anand188 ; There's been a recent fix to the Powermock migration recipe in:
- https://github.com/openrewrite/rewrite-testing-frameworks/pull/588
Would you mind trying again with the latest version? https://github.com/openrewrite/rewrite-testing-frameworks/releases/tag/v2.17.1
Beyond that your question lacks the details we need to replicate the issue; if the problems persist with the latest version I suggest you create a minimal reproducer.
@timtebeek tried 2.17.1 also doesn't seem to address the issue same not completing migrating.
PowerMockito.doThrow(new IllegalArgumentException()).when( xx.class,"abc",any()) these are still not migrated because when in Mockito only takes single argument unlike PowerMockito
Ah yes that form is not yet support; that makes this sounds more like a feature request to expand coverage of our Powermock migration recipe. Would you be willing to help out with it's implementation?
The first step would be a draft pull request that adds your case to this unit test; we can collaborate from there: https://github.com/openrewrite/rewrite-testing-frameworks/blob/e9497f1a56e075d5359a10b6356d580dc0ac5874/src/test/java/org/openrewrite/java/testing/mockito/ReplacePowerMockitoIntegrationTest.java#L620-L661
@timtebeek thanks let me see if its possible for me to learn and update this
Is this issue still being followed up? Similar issues.
PowerMockito.when(mockResource, "activelicense", any(), any()).thenCallRealMethod();
The actual situation is Mockito.when(mockResource, "activelicense", any(), any()).thenCallRealMethod();
The expectation isMockito.when(mockResource.activelicense(any(), any()).thenCallRealMethod();
https://docs.openrewrite.org/recipes/java/testing/mockito/replacepowermockito
Rewrite Testing Frameworks 3.14.1 rewrite-maven-plugin 6.15.0
hi @ChenyuWang98 ; while we'd love to support it I don't have time to fit this in myself; welcome to take a stab at it if you're looking to help out! 🙏🏻