You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "hysuuuu (via GitHub)" <gi...@apache.org> on 2026/08/26 21:02:34 UTC

[PR] KAFKA-20992: Remove hamcrest from org.apache.kafka.test package [kafka]

hysuuuu opened a new pull request, #23287:
URL: https://github.com/apache/kafka/pull/23287

   Replaces Hamcrest with JUnit 5 in `MockApiFixedKeyProcessor`.
   
   Testing
    `./gradlew streams:test --tests StreamsBuilderTest --tests KStreamImplTest`


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20992: Remove hamcrest from org.apache.kafka.test package [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st commented on code in PR #23287:
URL: https://github.com/apache/kafka/pull/23287#discussion_r3868033707


##########
streams/src/test/java/org/apache/kafka/test/MockApiFixedKeyProcessor.java:
##########
@@ -93,23 +92,23 @@ public void process(final FixedKeyRecord<KIn, VIn> record) {
     }
 
     public void checkAndClearProcessResult(final KeyValueTimestamp<?, ?>... expected) {
-        assertThat("the number of outputs:" + processed, processed.size(), is(expected.length));
+        assertEquals(expected.length, processed.size(), () -> "the number of outputs:" + processed);

Review Comment:
   ```suggestion
           assertEquals(expected.length, processed.size(), "the number of outputs:" + processed);
   ```



##########
streams/src/test/java/org/apache/kafka/test/MockApiFixedKeyProcessor.java:
##########
@@ -120,16 +119,16 @@ public void requestCommit() {
     }
 
     public void checkEmptyAndClearProcessResult() {
-        assertThat("the number of outputs:", processed.size(), is(0));
+        assertEquals(0, processed.size(), "the number of outputs:");

Review Comment:
   ```suggestion
           assertEquals(0, processed.size(), "the number of outputs:" + processed);
   ```



##########
streams/src/test/java/org/apache/kafka/test/MockApiFixedKeyProcessor.java:
##########
@@ -120,16 +119,16 @@ public void requestCommit() {
     }
 
     public void checkEmptyAndClearProcessResult() {
-        assertThat("the number of outputs:", processed.size(), is(0));
+        assertEquals(0, processed.size(), "the number of outputs:");
         processed.clear();
     }
 
     public void checkAndClearPunctuateResult(final PunctuationType type, final long... expected) {
         final ArrayList<Long> punctuated = type == PunctuationType.STREAM_TIME ? punctuatedStreamTime : punctuatedSystemTime;
-        assertThat("the number of outputs:", punctuated.size(), is(expected.length));
+        assertEquals(expected.length, punctuated.size(), "the number of outputs:");

Review Comment:
   ditto



##########
streams/src/test/java/org/apache/kafka/test/MockApiFixedKeyProcessor.java:
##########
@@ -93,23 +92,23 @@ public void process(final FixedKeyRecord<KIn, VIn> record) {
     }
 
     public void checkAndClearProcessResult(final KeyValueTimestamp<?, ?>... expected) {
-        assertThat("the number of outputs:" + processed, processed.size(), is(expected.length));
+        assertEquals(expected.length, processed.size(), () -> "the number of outputs:" + processed);
         for (int i = 0; i < expected.length; i++) {
             final FixedKeyRecord<KIn, VIn> record = processed.get(i);
-            assertThat(
-                "output[" + i + "]:",
+            assertEquals(
+                expected[i],
                 new KeyValueTimestamp<>(record.key(), record.value(), record.timestamp()),
-                is(expected[i])
+                "output[" + i + "]:"
             );
         }
 
         processed.clear();
     }
 
     public void checkAndClearProcessedRecords(final Record<?, ?>... expected) {
-        assertThat("the number of outputs:" + processed, processed.size(), is(expected.length));
+        assertEquals(expected.length, processed.size(), () -> "the number of outputs:" + processed);

Review Comment:
   ```suggestion
           assertEquals(expected.length, processed.size(), "the number of outputs:" + processed);
   ```



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20992: Remove hamcrest from org.apache.kafka.test package [kafka]

Posted by "hysuuuu (via GitHub)" <gi...@apache.org>.
hysuuuu commented on PR #23287:
URL: https://github.com/apache/kafka/pull/23287#issuecomment-5433396299

   @m1a2st Updated. PTAL, thanks!


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20992: Remove hamcrest from org.apache.kafka.test package [kafka]

Posted by "hysuuuu (via GitHub)" <gi...@apache.org>.
hysuuuu commented on PR #23287:
URL: https://github.com/apache/kafka/pull/23287#issuecomment-5447426923

   @m1a2st Of course. I've resolved the conflict. PTAL, thanks!


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20992: Remove hamcrest from org.apache.kafka.test package [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #23287:
URL: https://github.com/apache/kafka/pull/23287#discussion_r3871667949


##########
streams/src/test/java/org/apache/kafka/test/MockApiFixedKeyProcessor.java:
##########
@@ -93,23 +92,23 @@ public void process(final FixedKeyRecord<KIn, VIn> record) {
     }
 
     public void checkAndClearProcessResult(final KeyValueTimestamp<?, ?>... expected) {

Review Comment:
   I checked the usages and neither method is called anywhere, so we could just remove them, right?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: Remove unused methods in MockApiFixedKeyProcessor [kafka]

Posted by "m1a2st (via GitHub)" <gi...@apache.org>.
m1a2st merged PR #23287:
URL: https://github.com/apache/kafka/pull/23287


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20992: Remove hamcrest from org.apache.kafka.test package [kafka]

Posted by "hysuuuu (via GitHub)" <gi...@apache.org>.
hysuuuu commented on code in PR #23287:
URL: https://github.com/apache/kafka/pull/23287#discussion_r3874652318


##########
streams/src/test/java/org/apache/kafka/test/MockApiFixedKeyProcessor.java:
##########
@@ -93,23 +92,23 @@ public void process(final FixedKeyRecord<KIn, VIn> record) {
     }
 
     public void checkAndClearProcessResult(final KeyValueTimestamp<?, ?>... expected) {

Review Comment:
   Yes you're right, those methods are not used. I've removed them. Thanks.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org