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


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java:
##########
@@ -360,6 +367,18 @@ void testSendUnsentRequest() {
         assertFalse(networkClient.hasAnyPendingRequests());
     }
 
+    @Test
+    void testMetadataErrorEvent() {
+        metadata.fatalError(new AuthenticationException("Authentication 
failed"));
+
+        consumerNetworkThread.runOnce();
+        BackgroundEvent event = backgroundEventsQueue.poll();
+        assertNotNull(event);
+        assertEquals(BackgroundEvent.Type.ERROR, event.type());
+        assertEquals(AuthenticationException.class, ((ErrorEvent) 
event).error().getClass());
+        assertEquals("Authentication failed", ((ErrorEvent) 
event).error().getMessage());

Review Comment:
   this could be simplified to a single `assertEquals(authException, 
((ErrorEvent) event).error())`, with authException declared above and passed to 
the fatalError on ln 372



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