lianetm commented on code in PR #16140: URL: https://github.com/apache/kafka/pull/16140#discussion_r1631645522
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java: ########## @@ -72,68 +64,99 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class ConsumerNetworkThreadTest { - - private ConsumerTestBuilder testBuilder; - private Time time; - private ConsumerMetadata metadata; - private NetworkClientDelegate networkClient; - private BlockingQueue<ApplicationEvent> applicationEventsQueue; - private ApplicationEventProcessor applicationEventProcessor; - private OffsetsRequestManager offsetsRequestManager; - private CommitRequestManager commitRequestManager; - private CoordinatorRequestManager coordinatorRequestManager; - private ConsumerNetworkThread consumerNetworkThread; - private final CompletableEventReaper applicationEventReaper = mock(CompletableEventReaper.class); - private MockClient client; - - @BeforeEach - public void setup() { - testBuilder = new ConsumerTestBuilder(createDefaultGroupInformation()); - time = testBuilder.time; - metadata = testBuilder.metadata; - networkClient = testBuilder.networkClientDelegate; - client = testBuilder.client; - applicationEventsQueue = testBuilder.applicationEventQueue; - applicationEventProcessor = testBuilder.applicationEventProcessor; - commitRequestManager = testBuilder.commitRequestManager.orElseThrow(IllegalStateException::new); - offsetsRequestManager = testBuilder.offsetsRequestManager; - coordinatorRequestManager = testBuilder.coordinatorRequestManager.orElseThrow(IllegalStateException::new); - consumerNetworkThread = new ConsumerNetworkThread( - testBuilder.logContext, + static final int DEFAULT_HEARTBEAT_INTERVAL_MS = 1000; + static final long MAX_POLL_TIMEOUT_MS = 5000; Review Comment: let's better use the constant defined in ConsumerNetworkThread.MAX_POLL_TIMEOUT_MS so that we don't have to maintain this one (and avoid a test break if that one changes) -- 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