lintingbin opened a new pull request, #4204:
URL: https://github.com/apache/amoro/pull/4204

   ## What is this PR for?
   
   Closes part of #4203 (Step 2 — `amoro-optimizer-common`, the smallest leaf 
module).
   
   Migrates the 5 test files in `amoro-optimizer-common` to JUnit Jupiter:
   
   - `OptimizerTestBase`
   - `TestOptimizer`
   - `TestOptimizerToucher`
   - `TestOptimizerExecutor`
   - `TestOptimizerConfig`
   
   ## How TestAms is consumed without migrating it yet
   
   `OptimizerTestBase` previously held `@ClassRule public static TestAms 
TEST_AMS = new TestAms();`. `TestAms` extends 
`org.junit.rules.ExternalResource` and is shared across many modules, so per 
the staged plan in #4203 it stays on JUnit 4 until the very last (Step 9) PR.
   
   To unblock this step, the base class now invokes `TEST_AMS.before()` from 
`@BeforeAll` and `TEST_AMS.after()` from `@AfterAll`. Both methods are already 
`public` on `TestAms`, so no reflection or wrapper is needed and the lifecycle 
is identical to what `@ClassRule` produced. Once #4203 reaches Step 9, 
`TestAms` will move to a JUnit 5 `Extension` and these direct calls can be 
replaced with `@RegisterExtension` for free.
   
   ## Other mechanical changes
   
   - `org.junit.*` → `org.junit.jupiter.api.*`
   - `@Before` / `@After` → `@BeforeEach` / `@AfterEach`; `@BeforeClass` → 
`@BeforeAll`
   - `Assert.assertX(...)` → `Assertions.assertX(...)`
   - `TestOptimizerConfig`: three `@Test(expected = CmdLineException.class)` 
rewritten as `Assertions.assertThrows(CmdLineException.class, () -> ...)`
   - `TestOptimizer`: dropped its duplicate `@BeforeClass 
reduceCallAmsInterval()` because the parent already calls 
`OptimizerTestHelpers.setCallAmsIntervalForTest()` from `@BeforeAll`
   
   ## Type of change
   
   - [x] Improvement (test infrastructure)
   
   ## How was this patch tested?
   
   `mvn -pl amoro-optimizer/amoro-optimizer-common -am test` → 10/10 tests pass 
under the JUnit Platform provider, `mvn spotless:check` clean.


-- 
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]

Reply via email to