lianetm commented on code in PR #16200:
URL: https://github.com/apache/kafka/pull/16200#discussion_r1674142299


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManagerTest.java:
##########
@@ -201,8 +202,42 @@ public void testSuccessfulHeartbeatTiming() {
     @ParameterizedTest
     @ApiKeyVersionsSource(apiKey = ApiKeys.CONSUMER_GROUP_HEARTBEAT)
     public void 
testFirstHeartbeatIncludesRequiredInfoToJoinGroupAndGetAssignments(short 
version) {
-        resetWithZeroHeartbeatInterval(Optional.of(DEFAULT_GROUP_INSTANCE_ID));
+        membershipManager = new MembershipManagerImpl(
+                DEFAULT_GROUP_ID,
+                Optional.of(DEFAULT_GROUP_INSTANCE_ID),
+                0,
+                Optional.of(""),
+                subscriptions,
+                mock(CommitRequestManager.class),
+                (ConsumerMetadata) metadata,
+                logContext,
+                Optional.of(mock(ClientTelemetryReporter.class)),
+                backgroundEventHandler,
+                time,
+                new Metrics()
+        );
+        membershipManager.transitionToJoining();
+
+        heartbeatState = new HeartbeatState(
+                subscriptions,
+                membershipManager,
+                DEFAULT_MAX_POLL_INTERVAL_MS
+        );
+
+        heartbeatRequestManager = createHeartbeatRequestManager(
+                coordinatorRequestManager,
+                membershipManager,
+                heartbeatState,
+                heartbeatRequestState,
+                backgroundEventHandler
+        );
+        createHeartbeatStateWithZeroHeartbeatInterval();
+        time.sleep(DEFAULT_HEARTBEAT_INTERVAL_MS);
         String topic = "topic1";
+        // Make a singleton set
+        HashSet<String> set = new HashSet<>();
+        set.add(topic);

Review Comment:
   indeed, let's make a `Collections.singleton` set (and remove the comment and 
reuse the var on ln 241 too)



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