frankvicky commented on code in PR #17614:
URL: https://github.com/apache/kafka/pull/17614#discussion_r1818351582


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java:
##########
@@ -64,16 +66,24 @@ public class ConsumerNetworkThreadTest {
     private final CompletableEventReaper applicationEventReaper;
 
     ConsumerNetworkThreadTest() {
+        LogContext logContext = new LogContext();
+        this.time = new MockTime();
+        this.applicationEventsQueue = new LinkedBlockingQueue<>();
         this.networkClientDelegate = mock(NetworkClientDelegate.class);
-        this.requestManagers = mock(RequestManagers.class);
         this.offsetsRequestManager = mock(OffsetsRequestManager.class);
         this.heartbeatRequestManager = 
mock(ConsumerHeartbeatRequestManager.class);
         this.coordinatorRequestManager = mock(CoordinatorRequestManager.class);
         this.applicationEventProcessor = mock(ApplicationEventProcessor.class);
         this.applicationEventReaper = mock(CompletableEventReaper.class);
-        this.time = new MockTime();
-        this.applicationEventsQueue = new LinkedBlockingQueue<>();
-        LogContext logContext = new LogContext();
+        this.requestManagers = spy(new RequestManagers(logContext,

Review Comment:
   Since we directly call `requestManagers.consumerMembershipManager` in 
`ConsumerNetworkThread#closeInternal`, I replaced `mock` with `spy` to avoid an 
NPE.



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