Code of Conduct
Search before asking
Describe the feature
Migrate the Java test suites in the following Kyuubi-native modules from JUnit 4 to JUnit 5 (Jupiter):
kyuubi-rest-client
kyuubi-util
kyuubi-hive-jdbc
externals/kyuubi-data-agent-engine
The vendored Hive beeline tests under kyuubi-hive-beeline/src/test/java/org/apache/hive/beeline/ (package org.apache.hive.beeline) stay on JUnit 4 to remain aligned with upstream Hive and minimize sync friction.
Motivation
- JUnit 4 has been effectively in maintenance mode since
4.13.2 (Feb 2021). Modern test ecosystem (Mockito 5, Testcontainers, Spring Boot 3, etc.) defaults to JUnit 5.
- JUnit 5's
@ParameterizedTest removes the @Parameterized runner boilerplate currently used in kyuubi-hive-jdbc (3 files).
@TempDir parameter injection, assertAll, @Nested, and condition annotations (@EnabledIfSystemProperty, etc.) become available for future tests.
- Our usage is shallow (
@Test + @Before/@After + Assert + Parameterized); no @Rule/@ClassRule/Theories, so the migration is mostly mechanical.
Originally suggested in the AGENTS.md review on #7452.
Describe the solution
- Add
junit-bom 5.x to root dependencyManagement; keep junit:junit 4.13.2 for the vendored Hive beeline module.
- Switch the four target modules' POMs to
org.junit.jupiter:junit-jupiter.
- Mechanical source rewrites:
- Imports →
org.junit.jupiter.api.* / org.junit.jupiter.params.*
- Annotations:
@Before→@BeforeEach, @After→@AfterEach, @BeforeClass→@BeforeAll, @AfterClass→@AfterAll
Assert.assertX → Assertions.assertX (with message arg moved to last position)
Assume.assumeTrue → Assumptions.assumeTrue
@Test(expected = X.class) → assertThrows
@RunWith(Parameterized.class) + @Parameters → @ParameterizedTest + @MethodSource / @ValueSource
- Static imports only, no wildcard imports (google-java-format).
kyuubi-hive-beeline is out of scope — left on JUnit 4 to avoid diverging from upstream Hive's vendored tests.
Additional context
Surfaced during review of #7452:
seems it's time to upgrade to JUnit5 - should be straightforward, as we don't use many JUnit advanced features.
Are you willing to submit PR?
Code of Conduct
Search before asking
Describe the feature
Migrate the Java test suites in the following Kyuubi-native modules from JUnit 4 to JUnit 5 (Jupiter):
kyuubi-rest-clientkyuubi-utilkyuubi-hive-jdbcexternals/kyuubi-data-agent-engineThe vendored Hive beeline tests under
kyuubi-hive-beeline/src/test/java/org/apache/hive/beeline/(packageorg.apache.hive.beeline) stay on JUnit 4 to remain aligned with upstream Hive and minimize sync friction.Motivation
4.13.2(Feb 2021). Modern test ecosystem (Mockito 5, Testcontainers, Spring Boot 3, etc.) defaults to JUnit 5.@ParameterizedTestremoves the@Parameterizedrunner boilerplate currently used inkyuubi-hive-jdbc(3 files).@TempDirparameter injection,assertAll,@Nested, and condition annotations (@EnabledIfSystemProperty, etc.) become available for future tests.@Test+@Before/@After+Assert+Parameterized); no@Rule/@ClassRule/Theories, so the migration is mostly mechanical.Originally suggested in the AGENTS.md review on #7452.
Describe the solution
junit-bom5.x to rootdependencyManagement; keepjunit:junit4.13.2 for the vendored Hive beeline module.org.junit.jupiter:junit-jupiter.org.junit.jupiter.api.*/org.junit.jupiter.params.*@Before→@BeforeEach,@After→@AfterEach,@BeforeClass→@BeforeAll,@AfterClass→@AfterAllAssert.assertX→Assertions.assertX(with message arg moved to last position)Assume.assumeTrue→Assumptions.assumeTrue@Test(expected = X.class)→assertThrows@RunWith(Parameterized.class)+@Parameters→@ParameterizedTest+@MethodSource/@ValueSourcekyuubi-hive-beelineis out of scope — left on JUnit 4 to avoid diverging from upstream Hive's vendored tests.Additional context
Surfaced during review of #7452:
Are you willing to submit PR?