Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement of Replace PowerMockito with Mockito static mocking #312

Merged

Conversation

klauerm
Copy link
Contributor

@klauerm klauerm commented Feb 9, 2023

Fixes #293

klauerm and others added 22 commits January 27, 2023 15:07
…rMockitoIntegrationTest.java

Co-authored-by: Tim te Beek <timtebeek@gmail.com>
- First it removes the PowerMockTestCaseConfig extension
…template which I think is a bug in OpenRewrite.
- Unit tests are failing because of missing type
# Conflicts:
#	build.gradle.kts
#	src/main/java/org/openrewrite/java/testing/mockito/PowerMockitoMockStaticToMockito.java
#	src/test/java/org/openrewrite/java/testing/mockito/PowerMockitoMockStaticToMockitoTest.java
- Unit tests are failing because of missing type
- Unit tests are failing because of missing type
@klauerm
Copy link
Contributor Author

klauerm commented Feb 9, 2023

Hi @sambsnyd @timtebeek,
Can you have a look. The integration test src/test/java/org/openrewrite/java/testing/mockito/ReplacePowerMockitoIntegrationTest.java holds all the requirement we need for our code base. But it is still failing. I don't know how to fix the issue I mentioned in slack

- The testNG case is still missing

- Unit tests are failing because of missing type
@klauerm
Copy link
Contributor Author

klauerm commented Feb 10, 2023

@timtebeek I've fixed all tests except for 1 in src/test/java/org/openrewrite/java/testing/mockito/ReplacePowerMockitoIntegrationTest.java
Here the feature for using testng annotations, if the mockito tests are written with testng is still missng. Can you please activate this integration test for the pipeline again?
Thank you, Matthias

@timtebeek
Copy link
Contributor

As discussed on Slack

ReplacePowerMockitoIntegrationTest > testThatPowerMockitoIsReplacedInTestNGTests() FAILED
it seems to use @AfterEach instead of @AfterMethod
I think the maybeAddTearDownMethodBody function either needs to be aware of TestNG, and then add the corresponding AfterEach/AfterMethod annotation, or needs a twin to handle TestNG tear down.. now it seems specific to JUnit, and I'm not seeing an equivalent for TestNG

@timtebeek timtebeek marked this pull request as ready for review February 13, 2023 18:16
@sambsnyd sambsnyd merged commit 594a3df into openrewrite:main Feb 13, 2023
@sambsnyd
Copy link
Member

I haven't reviewed this in great detail, so there may be suggestions or improvements to come later, but for now we can merge and iterate on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Recipe - Replace PowerMockito with raw Mockito
4 participants