AndrewJSchofield commented on code in PR #19609: URL: https://github.com/apache/kafka/pull/19609#discussion_r2073967512
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java: ########## @@ -158,16 +157,16 @@ public void testStartupAndTearDown() throws InterruptedException { @Test public void testRequestsTransferFromManagersToClientOnThreadRun() { - List<Optional<? extends RequestManager>> list = new ArrayList<>(); - list.add(Optional.of(coordinatorRequestManager)); - list.add(Optional.of(heartbeatRequestManager)); - list.add(Optional.of(offsetsRequestManager)); + List<RequestManager> list = new ArrayList<>(); Review Comment: ``` List<RequestManager> list = List.of(coordinatorRequestManager, heartbeatRequestManager, offsetsRequestManager); ``` ########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java: ########## @@ -117,9 +116,9 @@ public void testEnsureCloseStopsRunningThread() { @ParameterizedTest @ValueSource(longs = {ConsumerNetworkThread.MAX_POLL_TIMEOUT_MS - 1, ConsumerNetworkThread.MAX_POLL_TIMEOUT_MS, ConsumerNetworkThread.MAX_POLL_TIMEOUT_MS + 1}) public void testConsumerNetworkThreadPollTimeComputations(long exampleTime) { - List<Optional<? extends RequestManager>> list = new ArrayList<>(); - list.add(Optional.of(coordinatorRequestManager)); - list.add(Optional.of(heartbeatRequestManager)); + List<RequestManager> list = new ArrayList<>(); Review Comment: @kirktrue I think I'm missing something here. Now that the list only contains `RequestManager` instances, can't you just write: ``` List<RequestManager> list = List.of(coordinatorRequestManager, heartbeatRequestManager); ``` I tried that locally and it looked good to me. -- 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