[KYUUBI #7473] Migrate Java tests from JUnit 4 to JUnit 5#7474
Open
wangzhigang1999 wants to merge 3 commits into
Open
[KYUUBI #7473] Migrate Java tests from JUnit 4 to JUnit 5#7474wangzhigang1999 wants to merge 3 commits into
wangzhigang1999 wants to merge 3 commits into
Conversation
pan3793
reviewed
May 25, 2026
70644df to
ac9b18c
Compare
- Add junit-bom 5.11.4 to root dependencyManagement; keep junit 4.13.2 for vendored Hive beeline tests under org.apache.hive.beeline. - Switch kyuubi-rest-client, kyuubi-util, kyuubi-hive-jdbc and kyuubi-data-agent-engine to junit-jupiter only. - Rewrite imports and annotations (@test, @before -> @beforeeach, ...), swap message argument from msg-first to msg-last, convert @RunWith(Parameterized.class) to @ParameterizedTest with @MethodSource / @valuesource, replace @test(expected=...) with assertThrows, and convert Assume.assumeTrue to Assumptions.assumeTrue. - Use static imports throughout per google-java-format (no class- qualified Assertions.X calls, no wildcard imports). - kyuubi-hive-beeline stays on JUnit 4 to avoid diverging from the vendored Apache Hive beeline tests.
ac9b18c to
5fa8033
Compare
Replace assertTrue(expr.equals(literal)) with assertEquals(literal, expr) in tests touched by the JUnit 5 migration, plus one assertTrue(x == 100) to assertEquals(100, x). Pure cleanup, no behavior change. Assisted-by: Claude:claude-opus-4-7
Assisted-by: Claude:claude-opus-4-7
Contributor
Author
|
Done — |
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.
Why are the changes needed?
Closes #7473.
JUnit 4 has been in maintenance mode since 4.13.2 (Feb 2021); modern Java test deps (Mockito 5, Testcontainers, etc.) target JUnit 5. Our usage is shallow (no
@Rule/@ClassRule/Theories), so the migration is mostly mechanical.Migrates all five modules with Java tests:
kyuubi-rest-client,kyuubi-util,kyuubi-hive-jdbc,kyuubi-hive-beeline, andexternals/kyuubi-data-agent-engine. Drops the directjunit:junitdependency andjunit.versionproperty from the root pom; transitive exclusions are kept.junit-jupiteris pinned to the latest stable, 5.14.4.How was this patch tested?
build/mvn -Pfast test -pl <module> -amon each of the five modules — all green.kyuubi-data-agent-enginehas 7 live tests skipped viaAssumptions.assumeTrue(require an external LLM API).dev/reformatclean.Was this patch authored or co-authored using generative AI tooling?
Assisted-by: Claude:claude-opus-4-7