lianetm commented on code in PR #14557:
URL: https://github.com/apache/kafka/pull/14557#discussion_r1426894017


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumerTest.java:
##########
@@ -463,35 +467,34 @@ public void testEnsurePollExecutedCommitAsyncCallbacks() {
         MockCommitCallback callback = new MockCommitCallback();
         CompletableFuture<Void> future = new CompletableFuture<>();
         consumer.assign(Collections.singleton(new TopicPartition("foo", 0)));
-        doReturn(future).when(consumer).commit(new HashMap<>(), false);
+        doReturn(future).when(consumer).commit(new HashMap<>(), false, 
Optional.empty());
         assertDoesNotThrow(() -> consumer.commitAsync(new HashMap<>(), 
callback));
         future.complete(null);
-        assertMockCommitCallbackInvoked(() -> consumer.poll(Duration.ZERO),
-            callback,
-            null);
+        assertMockCommitCallbackInvoked(() -> consumer.poll(Duration.ZERO), 
null);
     }
 
     @Test
     public void testEnsureShutdownExecutedCommitAsyncCallbacks() {
         MockCommitCallback callback = new MockCommitCallback();
         CompletableFuture<Void> future = new CompletableFuture<>();
-        doReturn(future).when(consumer).commit(new HashMap<>(), false);
+        doReturn(future).when(consumer).commit(new HashMap<>(), false, 
Optional.empty());
         assertDoesNotThrow(() -> consumer.commitAsync(new HashMap<>(), 
callback));
         future.complete(null);
-        assertMockCommitCallbackInvoked(() -> consumer.close(),
-            callback,
-            null);
+        assertMockCommitCallbackInvoked(() -> consumer.close(), null);
     }
 
     private void assertMockCommitCallbackInvoked(final Executable task,
-                                                 final MockCommitCallback 
callback,
-                                                 final Errors errors) {
-        assertDoesNotThrow(task);
-        assertEquals(1, callback.invoked);
-        if (errors == null)
-            assertNull(callback.exception);
-        else if (errors.exception() instanceof RetriableException)
-            assertTrue(callback.exception instanceof 
RetriableCommitFailedException);
+                                                 final Throwable 
expectedException) {
+        if (expectedException == null) {
+            assertDoesNotThrow(task);
+        } else {
+            Throwable t = assertThrows(Throwable.class, task);
+            if (expectedException instanceof RetriableException) {
+                assertTrue(t instanceof RetriableCommitFailedException);
+            } else {
+                assertEquals(t.getClass(), expectedException.getClass());
+            }

Review Comment:
   Agree, done. 



-- 
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