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


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerHeartbeatRequestManagerTest.java:
##########
@@ -603,29 +606,24 @@ public void testHeartbeatResponseOnErrorHandling(final 
Errors error, final boole
     }
 
     @Test
-    public void testUnsupportedVersion() {

Review Comment:
   Could you please consider using `ParameterizedTest` to eliminate duplicate 
code? 
   
   ```java
       @ParameterizedTest
       @ValueSource(strings = {CONSUMER_PROTOCOL_NOT_SUPPORTED_MSG, 
REGEX_RESOLUTION_NOT_SUPPORTED_MSG})
       public void testUnsupportedVersion(String errorMessage) {
           mockResponseWithException(new 
UnsupportedVersionException(errorMessage));
           ArgumentCaptor<ErrorEvent> errorEventArgumentCaptor = 
ArgumentCaptor.forClass(ErrorEvent.class);
           
verify(backgroundEventHandler).add(errorEventArgumentCaptor.capture());
           ErrorEvent errorEvent = errorEventArgumentCaptor.getValue();
           assertInstanceOf(Errors.UNSUPPORTED_VERSION.exception().getClass(), 
errorEvent.error());
           assertEquals(errorMessage, errorEvent.error().getMessage());
       }
   ```



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