spuru9 opened a new pull request, #28835:
URL: https://github.com/apache/flink/pull/28835
## What is the purpose of the change
This is a sub-task of the JUnit 5 migration. It removes the remaining
Hamcrest usages from the
`flink-streaming-java` test code, so the module asserts exclusively with
AssertJ and matches
arguments exclusively with Mockito's own matchers. After this change there
is no `hamcrest`
reference left anywhere under `flink-streaming-java/src`.
This is a test-only change; no production code is touched.
## Brief change log
- `TypeSafeMatcher`/`FeatureMatcher` instances that were bridged into
AssertJ via
`HamcrestCondition.matching(...)` are now native AssertJ `Condition`s,
so call sites read
`assertThat(state).is(hasActiveInProgressFile())`. This affects
`BucketTest`, `BucketsTest`,
`StreamGraphGeneratorExecutionModeDetectionTest` and
`StreamGraphGeneratorTest`.
- `MockitoHamcrest.argThat(...)` is replaced by
`ArgumentMatchers.argThat(...)`:
- the four session-window assigner tests express `containsInAnyOrder` as
a local
`Collection<TimeWindow>` matcher, which also removes the
`(Collection<TimeWindow>)` casts;
- `InternalWindowFunctionTest` replaces `contains` / `allOf` /
`hasEntry` /
`IsIterableContainingInOrder` with two small predicate helpers;
- `StreamTaskCancellationBarrierTest`'s `CheckpointExceptionMatcher` now
implements Mockito's
`ArgumentMatcher<CheckpointException>` (typed `matches`, description
via `toString()`)
instead of Hamcrest's `BaseMatcher`.
- Removes the unused `EqualsResourceSpecMatcher` from
`StreamGraphGeneratorTest` (nothing
referenced it) together with its now-orphaned `ResourceSpec` import.
## Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
The migrated assertions are covered by the tests they live in. Locally:
- the 10 touched test classes pass (99 tests);
- to confirm the rewrites are not vacuously true, each new predicate was
inverted one at a time
and the tests that use it failed as expected in every case;
- `mvn -pl flink-streaming-java test` reports 1100/1104 passing. The 4
failures are all in
`UnalignedCheckpointsInterruptibleTimersTest`, which this PR does not
touch, and they fail
identically on the base commit;
- Checkstyle reports 0 violations and Spotless is clean.
## 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**
--
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]