refactor: migrate JUnit 4 to JUnit 6.1.0#1728
Merged
Merged
Conversation
pjfanning
reviewed
Jun 26, 2026
| * </root> | ||
| * }}} | ||
| */ | ||
| @deprecated("Use LogCapturingExtension (JUnit Jupiter) instead", "2.1.0") |
Member
There was a problem hiding this comment.
Suggested change
| @deprecated("Use LogCapturingExtension (JUnit Jupiter) instead", "2.1.0") | |
| @deprecated("Use LogCapturingExtension (JUnit Jupiter) instead", "2.0.0") |
29c6a31 to
135c20f
Compare
Member
|
javafmt busted again |
135c20f to
a799164
Compare
Member
|
docs.scaladsl.CassandraSourceSpec has failed twice - could be flay or this PR might have made things worse |
Motivation: JUnit 4 is end-of-life. JUnit 6 unifies version numbering across Platform, Jupiter, and Vintage components. Modification: - Add JupiterKeys overrides for JUnit Jupiter and Platform 6.1.0 - Migrate ~98 test files from JUnit 4 to Jupiter - Create LogCapturingExtension for JUnit Jupiter - Deprecate LogCapturingJunit4 (use LogCapturingExtension instead) - Keep JUnit 4 dependency for deprecated testkit class Result: All tests run on JUnit 6.1.0. Deprecated LogCapturingJunit4 remains available for backward compatibility.
Motivation: CassandraSourceSpec was aborting in CI with a 4-second timeout waiting for keyspace creation. The Docker container startup can exceed 4 seconds on CI runners, causing the entire suite to abort before any test runs. Modification: Use an explicit 15-second patience timeout in beforeAll to match the keyspace statement timeout and the afterAll drop-keyspace timeout. Result: CassandraSourceSpec is less likely to abort due to slow Docker startup. Tests: Not run - infrastructure timing fix References: Refs apache#1728
…ning Motivation: sbt warns that ThisBuild / JupiterKeys.junitPlatformVersion is not used by any settings or tasks, adding noise to build output. Modification: Remove the unused override. Only junitJupiterVersion is needed to set the JUnit Jupiter dependency version to 6.1.0. Result: Clean sbt build output without lintUnused warnings. Tests: sbt headerCheckAll - passed References: Refs apache#1728
Motivation: Rebase onto main lost the elasticsearch parameterized test conversion commit. AmqpFlowTest had a coverage regression with a non-parameterized test. Three files still used JUnit 3 era assertion imports. Modification: - Restore ElasticsearchParameterizedTest and OpensearchParameterizedTest with correct @ParameterizedTest + @MethodSource from fork branch - Convert AmqpFlowTest.shouldEmitConfirmationForPublishedMessagesInSimpleFlow from @test to @ParameterizedTest @valuesource for full coverage - Replace junit.framework.TestCase imports with org.junit.jupiter.api.Assertions in JmsConnectorsTest (jakartams, jms) and AvroParquetSinkTest Result: All parameterized tests correctly use JUnit Jupiter patterns. No remaining JUnit 3 imports in the codebase. Tests: Not run locally - requires Docker for integration tests References: Refs apache#1728
db775af to
de1943a
Compare
…iscovery Motivation: All connector tests fail with "Found at least one JUnit 5 test silently ignored by SBT due to jupiter-interface not being on this projects test-classpath". The sbt-jupiter-interface plugin requires jupiter-interface on the test classpath to detect and run JUnit Jupiter tests. Modification: Add com.github.sbt.junit:jupiter-interface to the testkit module's dependencies so it is transitively available on all connector test classpaths via the existing .dependsOn(testkit % Test) wiring. Result: JUnit Jupiter tests are correctly discovered and executed across all connector modules. Tests: Not run - requires CI with Docker for full test suite References: Fixes apache#1728
Motivation: - elasticsearch tests fail to compile: cannot find symbol ParameterizedTest, MethodSource, Arguments (from junit-jupiter-params) - jakartams/jms tests fail to compile: assertTrue(String, boolean) is not valid for JUnit Jupiter which uses assertTrue(boolean, String) Modification: - Add junit-jupiter-params to testkit dependencies for transitive @ParameterizedTest/@MethodSource/@valuesource support - Swap assertTrue parameter order in JmsConnectorsTest (jms, jakartams) from JUnit 3 style (message, condition) to JUnit Jupiter style (condition, message) Result: All modules compile correctly with JUnit Jupiter assertions. Tests: Not run locally - requires CI References: Fixes apache#1728
Member
Author
|
It's now passed |
Member
Author
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
JUnit 4 is end-of-life. JUnit 6 unifies version numbering across Platform, Jupiter, and Vintage components.
Modification
LogCapturingExtensionfor JUnit JupiterLogCapturingJunit4(useLogCapturingExtensionfor JUnit Jupiter instead)Result
All tests run on JUnit 6.1.0. Deprecated JUnit 4 testkit class remains for backward compatibility.