[FLINK-29775][tests][JUnit5 migration] Module: flink-statebackend-rocksdb - #28943
Open
spuru9 wants to merge 1 commit into
Open
[FLINK-29775][tests][JUnit5 migration] Module: flink-statebackend-rocksdb#28943spuru9 wants to merge 1 commit into
spuru9 wants to merge 1 commit into
Conversation
Collaborator
spuru9
marked this pull request as draft
August 7, 2026 17:40
spuru9
commented
Aug 7, 2026
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| /** Test class for {@link DistributeStateHandlerHelper}. */ | ||
| public class DistributeStateHandlerHelperTest extends TestLogger { |
Contributor
Author
There was a problem hiding this comment.
extends TestLoggeris dropped without adding aMETA-INF/servicesfile —TestLoggerExtensionis already auto-registered from theflink-streaming-java` test-jar this module depends on.
spuru9
force-pushed
the
FLINK-29775
branch
2 times, most recently
from
August 7, 2026 18:42
b49f410 to
a49f5f9
Compare
spuru9
marked this pull request as ready for review
August 7, 2026 18:49
…ksdb Migrates the remaining JUnit 4 tests in flink-statebackend-rocksdb to JUnit 5 and converts their assertions to AssertJ, following the sibling flink-statebackend-forst migration (FLINK-39767) where the tests overlap. - @Rule/@ClassRule TemporaryFolder -> @tempdir (method parameter where a test needs a single directory, TempDirUtils otherwise) - @RunWith(Parameterized) -> @ParameterizedTest + @valuesource - @test(expected=...) and try/fail/catch -> assertThatThrownBy - org.junit.Assert and Hamcrest matchers -> AssertJ - org.junit.Assume -> AssertJ assumptions - dropped `extends TestLogger` and redundant `public` modifiers RocksDBExtension and RocksDBKeyedStateBackendTestFactory are test utilities rather than tests; they kept their JUnit 4 TemporaryFolder and are switched to plain temp directories / java.nio.file.Path so the module no longer depends on JUnit 4 at all. Generated-by: Claude Code (claude-opus-5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Migrates the remaining JUnit 4 tests in
flink-statebackend-rocksdbto JUnit 5 and converts their assertions to AssertJ, as part of FLINK-25325.Most tests in this module have a near-identical sibling in
flink-statebackend-forst, which was migrated in FLINK-39767 (6627acb). 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.*(outsideorg.junit.jupiter), no Hamcrest matchers, and noTestLogger.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)+@TestTemplateinRocksIncrementalCheckpointRescalingTest, matchingForStIncrementalCheckpointRescalingTest.@Test(expected = ...)and the manualtry { ...; fail(); } catch (X e) { ... }blocks →assertThatThrownBy(...)/assertThatCode(...).doesNotThrowAnyException().org.junit.Assertand 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.extends TestLoggerand the now-unnecessarypublicmodifiers on test classes and methods.RocksDBExtensionandRocksDBKeyedStateBackendTestFactoryare test utilities rather than tests, but were still holding a JUnit 4TemporaryFolder.RocksDBExtension(itself a JUnit 5 extension, so it cannot use@TempDirinjection) now creates and deletes its own temp directory;RocksDBKeyedStateBackendTestFactory.create(...)takes ajava.nio.file.Pathinstead.Assertion messages were kept via
.as(...). The ones that disappear arefail("...should have thrown")-style messages, whichassertThatThrownByexpresses 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-rocksdbpasses with the same number of tests before and after, per class:Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (claude-opus-5)