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

Upgrade JUnit4 to JUnit5 #1207

Merged
merged 2 commits into from
Feb 6, 2024
Merged

Conversation

pacphi
Copy link
Contributor

@pacphi pacphi commented Dec 31, 2023

In order to complete this upgrade, I followed public documentation, here:

https://docs.openrewrite.org/running-recipes/popular-recipe-guides/migrate-from-junit-4-to-junit-5

I employed OpenRewrite to perform initial bulk operation with:

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:5.1.7 \
  -Drewrite.activeRecipes=org.openrewrite.java.spring.boot2.SpringBoot2JUnit4to5Migration

I also upgraded dependencies and plugins in root pom.xml:

  • Jackson to 2.16.1
  • JUnit Jupiter to 5.10.1
  • Maven Compiler to 3.12.1
  • Maven Surefire to 3.2.3

Afterwards:

  • I adjusted imports on AbstractRestTest.java, then replaced a reference to org.junit.ComparisonFailure (no longer available in JUnit5) which was itself is a subclass of java.lang.AssertionError.
  • I had to update DefaultApplicationsTest.java, DefaultSpacesTest.java where Supplier<T> anonymous impl for get() method did not have correct visibility.

Result:

@pivotal-david-osullivan pivotal-david-osullivan merged commit 1fa9e71 into cloudfoundry:main Feb 6, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants