philipnee commented on code in PR #14123:
URL: https://github.com/apache/kafka/pull/14123#discussion_r1279890789


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/PrototypeAsyncConsumerTest.java:
##########
@@ -153,12 +154,32 @@ public void testCommitAsync_UserSuppliedCallback() {
     @SuppressWarnings("unchecked")
     public void testCommitted() {
         Set<TopicPartition> mockTopicPartitions = 
mockTopicPartitionOffset().keySet();
-        mockConstruction(OffsetFetchApplicationEvent.class, (mock, ctx) -> {
-            when(mock.complete(any())).thenReturn(new HashMap<>());
-        });
-        consumer = newConsumer(time, new StringDeserializer(), new 
StringDeserializer());
-        assertDoesNotThrow(() -> consumer.committed(mockTopicPartitions, 
Duration.ofMillis(1)));
-        
verify(eventHandler).add(ArgumentMatchers.isA(OffsetFetchApplicationEvent.class));
+        CompletableFuture<Map<TopicPartition, OffsetAndMetadata>> 
committedFuture = new CompletableFuture<>();
+        try (MockedConstruction<OffsetFetchApplicationEvent> mockConstruction =
+                 mockConstruction(OffsetFetchApplicationEvent.class, (mock, 
ctx) -> {
+                     when(mock.future()).thenReturn(committedFuture);
+                 })) {
+            committedFuture.complete(mockTopicPartitionOffset());
+            consumer = newConsumer(time, new StringDeserializer(), new 
StringDeserializer());
+            assertDoesNotThrow(() -> consumer.committed(mockTopicPartitions, 
Duration.ofMillis(1000)));
+            
verify(eventHandler).add(ArgumentMatchers.isA(OffsetFetchApplicationEvent.class));
+        }
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")

Review Comment:
   you are 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-unsubscr...@kafka.apache.org

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

Reply via email to