spuru9 opened a new pull request, #28943: URL: https://github.com/apache/flink/pull/28943
## What is the purpose of the change Migrates the remaining JUnit 4 tests in `flink-statebackend-rocksdb` to JUnit 5 and converts their assertions to AssertJ, as part of [FLINK-25325](https://issues.apache.org/jira/browse/FLINK-25325). Most tests in this module have a near-identical sibling in `flink-statebackend-forst`, which was migrated in FLINK-39767 (6627acb4231). Where a sibling exists, this PR follows it so the two modules stay consistent. After this change the module has no reference to `org.junit.*` (outside `org.junit.jupiter`), no Hamcrest matchers, and no `TestLogger`. ## Brief change log - `@Rule` / `@ClassRule TemporaryFolder` → `@TempDir`. A test that needs a single directory takes it as a method parameter (`@TempDir File dir`); `TempDirUtils.newFolder(root)` is kept only where one test needs several distinct directories. - `@RunWith(Parameterized.class)` → `@ExtendWith(ParameterizedTestExtension.class)` + `@TestTemplate` in `RocksIncrementalCheckpointRescalingTest`, matching `ForStIncrementalCheckpointRescalingTest`. - `@Test(expected = ...)` and the manual `try { ...; fail(); } catch (X e) { ... }` blocks → `assertThatThrownBy(...)` / `assertThatCode(...).doesNotThrowAnyException()`. - `org.junit.Assert` and Hamcrest matchers → AssertJ, preferring the native idioms (`hasSize`, `containsExactly`, `containsExactlyInAnyOrderElementsOf`, `isInstanceOf`, `hasToString`, `hasBinaryContent`, `exists`/`doesNotExist`, `allMatch`, `satisfiesAnyOf`, `hasCause`/`hasMessageContaining`). - `org.junit.Assume` → `org.junit.jupiter.api.Assumptions`. - Dropped `extends TestLogger` and the now-unnecessary `public` modifiers on test classes and methods. - `RocksDBExtension` and `RocksDBKeyedStateBackendTestFactory` are test utilities rather than tests, but were still holding a JUnit 4 `TemporaryFolder`. `RocksDBExtension` (itself a JUnit 5 extension, so it cannot use `@TempDir` injection) now creates and deletes its own temp directory; `RocksDBKeyedStateBackendTestFactory.create(...)` takes a `java.nio.file.Path` instead. Assertion messages were kept via `.as(...)`. The ones that disappear are `fail("...should have thrown")`-style messages, which `assertThatThrownBy` expresses natively, and messages whose content AssertJ already prints (e.g. `assertThat(errorRef.get()).isNull()` prints the throwable). ## Verifying this change This change is a test-only rework; it is verified by the existing tests it migrates. `mvn verify -pl flink-state-backends/flink-statebackend-rocksdb` passes with the same number of tests before and after, per class: - before: 843 unit tests (9 skipped) + 2 integration tests - after: 843 unit tests (9 skipped) + 2 integration tests ## 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 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (Claude Code) Generated-by: Claude Code (claude-opus-5) -- 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]
