-
Notifications
You must be signed in to change notification settings - Fork 59
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
Problem with using JUnit4to5Migration #457
Comments
Hi @ErhardSiegl ; From the above it seems we might want to change the UseMockitoExtension recipe as defined here rewrite-testing-frameworks/src/main/resources/META-INF/rewrite/junit5.yml Lines 180 to 197 in 430f635
Or maybe even better: add the above to mockito.yml such that it's included as part of |
Hi @timtebeek,
is apparently not included in the recipes. But maybe |
Hi @ErhardSiegl ; not problem at all; I've applied part of your suggested changes in 216983b just now. The To answer your question about how recipe changes are tested, you can have a look at this example test that's part of the Mockito and JUnit Jupiter migration. Lines 29 to 68 in 53cfd4c
Similar tests can be added if you feel there are cases left uncovered. Thanks for reporting your issue and suggested improvements! |
Discussed in openrewrite/rewrite#3911
Originally posted by ErhardSiegl January 13, 2024
I'm rather new to OpenRewrite. I tried to migrate a project from Junit4 to Junit5 with
org.openrewrite.java.testing.junit5.JUnit4to5Migration
. The Java files worked fine, but the the Jupiter dependencies were not added to the pom.xml. When I changed the recipe in the following way it worked:It seems that the
onlyIfUsing
needs the original class (org.junit.Test
) and not the classname which is created by the recipe (org.junit.jupiter.api.Test
). Is this a bug in the recipe or did I miss anything? I use the following configuration:and start it with
mvn rewrite:run -Drewrite.activeRecipes=org.openrewrite.java.testing.junit5.JUnit4to5Migration1
rewrite.yml.txt
The text was updated successfully, but these errors were encountered: