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


##########
clients/src/main/java/org/apache/kafka/common/requests/DeleteTopicsRequest.java:
##########
@@ -75,9 +75,7 @@ public DeleteTopicsRequestData data() {
     @Override
     public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) {
         DeleteTopicsResponseData response = new DeleteTopicsResponseData();
-        if (version() >= 1) {
-            response.setThrottleTimeMs(throttleTimeMs);
-        }
+        response.setThrottleTimeMs(throttleTimeMs);

Review Comment:
   Would you mind adding a unit test for `getErrorResponse` to 
`DeleteTopicsRequestTest`? For example:
   ```java
   @Test
   public void testGetErrorResponse() {
       for (short version : DELETE_TOPICS.allVersions()) {
           var request = new DeleteTopicsRequest.Builder(
                   new 
DeleteTopicsRequestData().setTopicNames(List.of("topic1", 
"topic2"))).build(version);
           var response = (DeleteTopicsResponse) request.getErrorResponse(10, 
Errors.UNKNOWN_SERVER_ERROR.exception());
   
           assertEquals(10, response.throttleTimeMs());
           assertEquals(2, response.data().responses().size());
           response.data().responses().forEach(r ->
                   assertEquals(Errors.UNKNOWN_SERVER_ERROR.code(), 
r.errorCode()));
       }
   }
   ```



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