avro icon indicating copy to clipboard operation
avro copied to clipboard

AVRO-3579: Migrate to JUnit 5

Open clesaec opened this issue 1 year ago • 3 comments

AVRO-3579 : migration to JUnit5 using command :

mvn org.openrewrite.maven:rewrite-maven-plugin:4.27.0:run \
    -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:1.24.0 \
    -DactiveRecipes=org.openrewrite.java.testing.junit5.JUnit5BestPractices

plus fix bugs generated by it. Some unit test are still in JUnit4, and will be changed in another PR.

Some test, like TestSchemaValidation.testSchemaCompatibilityFailures were fixed, this one, currently in JUnit4 run only first step of the for loop (So, most of them are ignored)

clesaec avatar Jul 22 '22 10:07 clesaec

You might also want to consider running this additional recipe to strip test prefix from test method names.

mvn org.openrewrite.maven:rewrite-maven-plugin:4.32.0:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:1.26.1 \
  -DactiveRecipes=org.openrewrite.java.testing.cleanup.RemoveTestPrefix

This prefix was required in JUnit 3, but is no longer needed; it gives a push towards better test method names.

timtebeek avatar Aug 29 '22 10:08 timtebeek

rewrite-maven-plugin Done, but with manual fixes because some tests named testHashCode, or testToString can't be renamed without "test", some tests have "extends" classes or other have explicit calls, and testStaticMethode can't be renamed to staticMethod.

clesaec avatar Aug 29 '22 11:08 clesaec

Done, but with manual fixes because some tests named testHashCode, or testToString can't be renamed without "test", some tests have "extends" classes or other have explicit calls, and testStaticMethode can't be renamed to staticMethod.

You're absolutely right; sorry for the inconvenience; these issues have already been solved, but we're still waiting on a new release. I expect one soon though :crossed_fingers:.

timtebeek avatar Aug 29 '22 11:08 timtebeek