wangzhigang1999 opened a new issue, #7473: URL: https://github.com/apache/kyuubi/issues/7473
### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) ### Search before asking - [x] I have searched in the [issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no similar issues. ### 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](https://github.com/apache/kyuubi/pull/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? - [x] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to improve. - [ ] No. I cannot submit a PR at this time. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
