DevJunz opened a new pull request, #23389:
URL: https://github.com/apache/kafka/pull/23389
Modernize the remaining try/call/fail/catch exception assertions in the
`org.apache.kafka.streams` and `org.apache.kafka.streams.kstream` test
packages to `assertThrows`, following the same cleanup as #23277 and #19975.
Changed (32 assertions in 7 files)
- `TopologyTest` (14), `TimeWindowsTest` (4), `JoinWindowsTest` (3),
`SessionWindowsTest` (1), `NamedTest` (1): the catch blocks were empty, so
they are replaced with a plain `assertThrows(...)`. `assertThrows` fails on
its own when nothing is thrown and pins the exception type, so a missing
`fail()` can no longer let a test pass silently. `NamedTest` keeps its
per-name failure message as the third argument because it loops over
several invalid names.
- `StreamsConfigTest` (5), `KafkaStreamsTest` (4): where the catch block
asserted on the exception message, the `assertThrows` return value keeps
that check.
- The now unused `Assertions.fail` static import is removed where no other
`fail()` call remains.
Deliberately left unchanged
- `KafkaStreamsTest#shouldThrowTopologyExceptionOnEmptyTopology`, which
uses `fail()` inside a try-with-resources block that also closes the
`KafkaStreams` instance; it is a different idiom.
- Files in `streams.processor.internals`, `streams.state.internals`,
`streams.integration` and `streams.internals`, which are being touched by
the in-flight Hamcrest removal PRs (#23307, #23386, #23387) and would
conflict.
Testing
- `./gradlew :streams:checkstyleTest :streams:spotlessCheck :streams:test`
for `TopologyTest`, `StreamsConfigTest`, `KafkaStreamsTest`,
`TimeWindowsTest`, `JoinWindowsTest`, `SessionWindowsTest` and `NamedTest`
on Temurin 17, all green.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
--
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]