Skip to content

KAFKA-20962: Remove hamcrest from org.apache.kafka.streams.kstream.internals.suppress package - #23199

Open
harmadasg wants to merge 5 commits into
apache:trunkfrom
harmadasg:KAFKA-20962
Open

KAFKA-20962: Remove hamcrest from org.apache.kafka.streams.kstream.internals.suppress package#23199
harmadasg wants to merge 5 commits into
apache:trunkfrom
harmadasg:KAFKA-20962

Conversation

@harmadasg

@harmadasg harmadasg commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Migrate usages of hamcrest to junit

Reviewers: Chia-Ping Tsai chia7712@gmail.com

@github-actions github-actions Bot added triage PRs from the community streams tests Test fixes (including flaky tests) labels Aug 19, 2026
verifyMetric(metrics, bufferSizeMaxMetric, is(82.0));
verifyMetric(metrics, bufferCountAvgMetric, is(1.0));
verifyMetric(metrics, bufferCountMaxMetric, is(2.0));
assertEquals(evictionRateMetric.description(), metrics.get(evictionRateMetric).metricName().description());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates the description check in verifyMetric.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I missed the verifyMetric call from the above block on the very same metric, fixed it in 68c1948

@github-actions github-actions Bot removed the triage PRs from the community label Aug 26, 2026

@chia7712 chia7712 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -428,7 +423,7 @@ public void suppressShouldShutDownWhenOverRecordCapacity() {
harness.processor.process(new Record<>("dummyKey", value, timestamp));
fail("expected an exception");
} catch (final StreamsException e) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind rewriting these two tests using assertThrows?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure no problem the test code looks more idiomatic based on your suggestion. Fixed it in both places

fail("expected an exception");
} catch (final StreamsException e) {
assertThat(e.getMessage(), containsString("buffer exceeded its max capacity"));
assertTrue(e.getMessage().contains("buffer exceeded its max capacity"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

try {
final Throwable exception = assertThrows(StreamsException.class, () -> {
harness.processor.process(new Record<>("dummyKey", value, timestamp));
fail("expected an exception");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove fail("expected an exception");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks done, also included the the exception message comparison in the assertThrows part to be more compact and readable

try {
final Throwable exception = assertThrows(StreamsException.class, () -> {
harness.processor.process(new Record<>("dummyKey", value, timestamp));
fail("expected an exception");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

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

Labels

ci-approved streams tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants