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


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerHeartbeatRequestManagerTest.java:
##########
@@ -604,23 +605,24 @@ public void testHeartbeatResponseOnErrorHandling(final 
Errors error, final boole
 
     @Test
     public void testUnsupportedVersion() {
-        mockErrorResponse(Errors.UNSUPPORTED_VERSION, null);
+        // UnsupportedApiVersion thrown while building request when the client 
detects the HB API is not supported.
+        String hbNotSupportedMsg = "The cluster does not support the new 
CONSUMER group protocol. Set group" +
+            ".protocol=classic on the consumer configs to revert to the 
CLASSIC protocol until the cluster is " +
+            "upgraded.";
+        mockResponseWithException(new 
UnsupportedVersionException(hbNotSupportedMsg));
         ArgumentCaptor<ErrorEvent> errorEventArgumentCaptor = 
ArgumentCaptor.forClass(ErrorEvent.class);
         verify(backgroundEventHandler).add(errorEventArgumentCaptor.capture());
         ErrorEvent errorEvent = errorEventArgumentCaptor.getValue();
-
-        // UnsupportedApiVersion in HB response without any custom message. 
It's considered as new protocol not supported.
-        String hbNotSupportedMsg = "The cluster does not support the new 
consumer group protocol. Set group" +
-            ".protocol=classic on the consumer configs to revert to the 
classic protocol until the cluster is upgraded.";
         assertInstanceOf(Errors.UNSUPPORTED_VERSION.exception().getClass(), 
errorEvent.error());
         assertEquals(hbNotSupportedMsg, errorEvent.error().getMessage());
         clearInvocations(backgroundEventHandler);
 
-        // UnsupportedApiVersion in HB response with custom message. Specific 
to required version not present, should
-        // keep the custom message.
-        String hbVersionNotSupportedMsg = "The cluster does not support 
resolution of SubscriptionPattern on version 0. " +
-            "It must be upgraded to version >= 1 to allow to subscribe to a 
SubscriptionPattern.";
-        mockErrorResponse(Errors.UNSUPPORTED_VERSION, 
hbVersionNotSupportedMsg);
+        // UnsupportedApiVersion thrown while building request when the client 
detects that a required HB API version
+        // is not available.
+        String hbVersionNotSupportedMsg = "The cluster does not support 
regular expressions resolution " +

Review Comment:
   for this one we had no constant so added it and reused here.  



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to