Skip to content

KAFKA-20965: Remove hamcrest from org.apache.kafka.streams.state.internals.metrics package - #23201

Open
korih wants to merge 1 commit into
apache:trunkfrom
korih:KAFKA-20965-hamcrest-state-metrics
Open

KAFKA-20965: Remove hamcrest from org.apache.kafka.streams.state.internals.metrics package#23201
korih wants to merge 1 commit into
apache:trunkfrom
korih:KAFKA-20965-hamcrest-state-metrics

Conversation

@korih

@korih korih commented Aug 19, 2026

Copy link
Copy Markdown

Migrated hamcrest to junit

Copilot AI lite review requested due to automatic review settings August 19, 2026 23:10
@github-actions github-actions Bot added triage PRs from the community streams tests Test fixes (including flaky tests) small Small PRs labels Aug 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Kafka Streams state-store metrics unit tests in org.apache.kafka.streams.state.internals.metrics to eliminate Hamcrest usage by switching assertions to JUnit Jupiter.

Changes:

  • Replaced assertThat(..., is(...)) with Assertions.assertEquals(...) for object and message comparisons.
  • Replaced notNullValue() checks with Assertions.assertNotNull(...) where applicable.
  • Removed Hamcrest static imports from the affected test classes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
streams/src/test/java/org/apache/kafka/streams/state/internals/metrics/StateStoreMetricsTest.java Switches Hamcrest assertThat/is to JUnit assertEquals for sensor verification.
streams/src/test/java/org/apache/kafka/streams/state/internals/metrics/RocksDBMetricsTest.java Replaces Hamcrest equality assertion with JUnit assertEquals.
streams/src/test/java/org/apache/kafka/streams/state/internals/metrics/RocksDBMetricsRecorderTest.java Converts multiple Hamcrest assertions (including exception message checks) to JUnit assertEquals.
streams/src/test/java/org/apache/kafka/streams/state/internals/metrics/RocksDBMetricsRecorderGaugesTest.java Replaces Hamcrest null/equality assertions with assertNotNull and assertEquals.
streams/src/test/java/org/apache/kafka/streams/state/internals/metrics/NamedCacheMetricsTest.java Updates Hamcrest sensor equality assertion to JUnit assertEquals.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot removed the triage PRs from the community label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small Small PRs streams tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants