Copilot commented on code in PR #20544:
URL: https://github.com/apache/kafka/pull/20544#discussion_r2413715569


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java:
##########
@@ -1955,17 +1944,23 @@ public void shouldComputeOffsetSumForStandbyTask() 
throws Exception {
         );
         final Map<TaskId, Long> expectedOffsetSums = mkMap(mkEntry(taskId00, 
15L));
 
+        final StandbyTask standbyTask = standbyTask(taskId00, 
taskId00ChangelogPartitions)
+            .inState(State.RUNNING)
+            .withInputPartitions(taskId00Partitions)
+            .build();
+        when(standbyTask.changelogOffsets()).thenReturn(changelogOffsets);
+
+        final TasksRegistry tasks = mock(TasksRegistry.class);
+        taskManager = 
setUpTaskManagerWithStateUpdater(StreamsConfigUtils.ProcessingMode.AT_LEAST_ONCE,
 tasks, false);

Review Comment:
   Direct assignment to the instance variable 'taskManager' in a test method 
can lead to confusion and potential test interference. Consider using a local 
variable instead.
   ```suggestion
           final TaskManager taskManager = 
setUpTaskManagerWithStateUpdater(StreamsConfigUtils.ProcessingMode.AT_LEAST_ONCE,
 tasks, false);
   ```



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