openzipkin / zipkin-reporter-java

Shared library for reporting zipkin spans on transports such as http or kafka
Apache License 2.0
126 stars 70 forks source link

refactor: migrates from JUnit 4 to JUnit 5 (Jupiter) #222

Closed codefromthecrypt closed 11 months ago

codefromthecrypt commented 11 months ago

This migrates from JUnit 4 to JUnit 5 (Jupiter) beginning with the following OpenRewrite command:

$ ./mvnw -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:LATEST \
  -Drewrite.activeRecipes=org.openrewrite.java.testing.junit5.JUnit4to5Migration

After this, we had to do some work, notably as Brave needs to support non-alpha versions of OkHttp and alpha 5 creates a classpath conflict on Okio. Notably, I had to revert changes for the okhttp and urlconnection senders, which formerly used normal mockwebserver 3 and were automatically migrated to v5 alpha.

Next, I had to polish formatting as it undid some of that, and also fixed some cases where we were inconsistent. Then, I reviewed our base pom and removed some special cases that were no longer needed. Finally, I swept through and reduced visibility modifiers where possible.

Note: Both testcontainers and mockwebserver v3 have an implicit dep on junit 4. This is ok and the same as zipkin. The main thing here is we aren't explicitly using it anymore.

codefromthecrypt commented 11 months ago

cc @timtebeek I think this particular OpenRewrite migration will also be rough in the other projects for reasons above, but yeah still helpful and hopefully paves a path for cleaner refactors later.

codefromthecrypt commented 11 months ago

thanks for letting me interrupt you yet another day in a row @anuraaga!