brandboat commented on code in PR #18105:
URL: https://github.com/apache/kafka/pull/18105#discussion_r1880344824


##########
core/src/test/java/kafka/test/api/ShareConsumerTest.java:
##########
@@ -1843,47 +1725,47 @@ private void produceMessagesWithTimestamp(int 
messageCount, long startingTimesta
         }
     }
 
-    private void consumeMessages(AtomicInteger totalMessagesConsumed,
+    private int consumeMessages(AtomicInteger totalMessagesConsumed,
                                  int totalMessages,
                                  String groupId,
                                  int consumerNumber,
                                  int maxPolls,
-                                 boolean commit,
-                                 CompletableFuture<Integer> future) {
-        try (KafkaShareConsumer<byte[], byte[]> shareConsumer = 
createShareConsumer(new ByteArrayDeserializer(), new ByteArrayDeserializer(), 
groupId)) {
-            shareConsumer.subscribe(Collections.singleton(tp.topic()));
-            consumeMessages(shareConsumer, totalMessagesConsumed, 
totalMessages, consumerNumber, maxPolls, commit, future);
-        } catch (Exception e) {
-            fail("Consumer " + consumerNumber + " failed with exception: " + 
e);
-        }
+                                 boolean commit) {
+        return assertDoesNotThrow(() -> {
+            try (KafkaShareConsumer<byte[], byte[]> shareConsumer = 
createShareConsumer(
+                    new ByteArrayDeserializer(), new ByteArrayDeserializer(), 
groupId)) {
+                shareConsumer.subscribe(Collections.singleton(tp.topic()));
+                return consumeMessages(shareConsumer, totalMessagesConsumed, 
totalMessages, consumerNumber, maxPolls, commit);

Review Comment:
   Sorry for the late reply, I added error message to all assertDoesNotThrow 
methods in this test. 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-unsubscr...@kafka.apache.org

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

Reply via email to