lianetm commented on code in PR #16140:
URL: https://github.com/apache/kafka/pull/16140#discussion_r1630075479
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java:
##########
@@ -341,6 +309,24 @@ void testRunOnceInvokesReaper() {
@Test
void testSendUnsentRequest() {
+ NetworkClientDelegate networkClientDelegate = new
NetworkClientDelegate(
Review Comment:
This could all be greatly simplified. What about replacing the whole test
with something like:
```
when(networkClientDelegate.hasAnyPendingRequests()).thenReturn(true).thenReturn(true).thenReturn(false);
consumerNetworkThread.cleanup();
verify(networkClientDelegate, times(2)).poll(anyLong(), anyLong());
```
The responsibility of the component is only to poll the network client as
long as there are pending requests, so with the above we verify that (no need
to get into creating an actual network client and assert on it, etc). Makes
sense?
--
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]