Skip to content

[FLINK-39767][tests][JUnit5 migration] Module: flink-statebackend-forst#28261

Open
spuru9 wants to merge 1 commit into
apache:masterfrom
spuru9:feature/junit5-forst
Open

[FLINK-39767][tests][JUnit5 migration] Module: flink-statebackend-forst#28261
spuru9 wants to merge 1 commit into
apache:masterfrom
spuru9:feature/junit5-forst

Conversation

@spuru9
Copy link
Copy Markdown
Contributor

@spuru9 spuru9 commented May 26, 2026

What is the purpose of the change

Migrate all JUnit 4 tests in flink-state-backends/flink-statebackend-forst to JUnit 5 (Jupiter) as part of the ongoing migration tracked under FLINK-25325. This eliminates the last JUnit 4 imports from the ForSt module.

JIRA: FLINK-39767

Brief change log

9 test files migrated:

  • ForStIncrementalCheckpointRescalingTest — parameterized: @RunWith(Parameterized.class)@ExtendWith(ParameterizedTestExtension.class) with @TestTemplate
  • ForStInitITCase
  • ForStMemoryControllerUtilsTest
  • ForStMultiClassLoaderTest
  • ForStNativeMetricOptionsTest
  • ForStOperationsUtilsTest
  • ForStResourceContainerTest
  • ForStStateBackendConfigTest
  • ForStStateBackendFactoryTest

Per-file changes:

  • org.junit.* imports → org.junit.jupiter.api.*
  • @Before / @After / @BeforeClass / @AfterClass@BeforeEach / @AfterEach / @BeforeAll / @AfterAll
  • @Rule TemporaryFolder / @ClassRule TemporaryFolder@TempDir java.nio.file.Path + TempDirUtils.newFolder(...) / TempDirUtils.newFile(...)
  • @Test(expected = X.class)assertThatThrownBy(...).isInstanceOf(X.class)
  • Hamcrest + org.junit.Assert.* → AssertJ (project convention)
  • Drop extends TestLogger and public modifiers per the Flink JUnit 5 Migration Guide

No production code is touched.

Verifying this change

This change is a test refactor and is covered by the migrated tests themselves:

./mvnw -pl flink-state-backends/flink-statebackend-forst test

Result: 976 tests run, 0 failures, 0 errors, 5 skipped. Total test count and pass/skip distribution match the pre-migration baseline.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code

Migrate all JUnit 4 tests in flink-statebackend-forst to JUnit 5 (Jupiter):

- Replace org.junit.* imports with org.junit.jupiter.api.*
- @Before/@After/@BeforeClass/@afterclass -> @BeforeEach/@AfterEach/@BeforeAll/@afterall
- @Rule/@ClassRule TemporaryFolder -> @tempdir + TempDirUtils helpers
- @test(expected = X.class) -> assertThatThrownBy(...).isInstanceOf(X.class)
- @RunWith(Parameterized.class) -> @ExtendWith(ParameterizedTestExtension.class)
  with Flink's @Parameters/@parameter annotations and @testtemplate
- Hamcrest + org.junit.Assert.* assertions -> AssertJ (project convention)
- Drop extends TestLogger and public modifiers per the migration guide
@flinkbot
Copy link
Copy Markdown
Collaborator

flinkbot commented May 26, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants