jsancio commented on code in PR #16399:
URL: https://github.com/apache/kafka/pull/16399#discussion_r1651117067


##########
raft/src/test/java/org/apache/kafka/raft/RaftClientTestContext.java:
##########
@@ -628,7 +629,7 @@ void deliverResponse(int correlationId, Node source, 
ApiMessage response) {
     RaftRequest.Outbound assertSentBeginQuorumEpochRequest(int epoch, int 
numBeginEpochRequests) {
         List<RaftRequest.Outbound> requests = collectBeginEpochRequests(epoch);
         assertEquals(numBeginEpochRequests, requests.size());
-        return requests.get(0);
+        return !requests.isEmpty() ? requests.get(0) : null;

Review Comment:
   Let's avoid returning `null` from "public" methods.
   
   We normally don't test the absence of a side effect because those checks are 
technically infinite. Maybe we can expose `collectBeginEpochRequests` as 
package private and check the size of the list.



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