clolov commented on code in PR #15254:
URL: https://github.com/apache/kafka/pull/15254#discussion_r1465053043


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java:
##########
@@ -5153,14 +5128,14 @@ private void makeTaskFolders(final String... names) 
throws Exception {
         for (int i = 0; i < names.length; ++i) {
             taskFolders.add(new TaskDirectory(testFolder.newFolder(names[i]), 
null));
         }
-        
expect(stateDirectory.listNonEmptyTaskDirectories()).andReturn(taskFolders).once();
+        
when(stateDirectory.listNonEmptyTaskDirectories()).thenReturn(taskFolders);
     }
 
     private void writeCheckpointFile(final TaskId task, final 
Map<TopicPartition, Long> offsets) throws Exception {
         final File checkpointFile = getCheckpointFile(task);
         Files.createFile(checkpointFile.toPath());
         new OffsetCheckpoint(checkpointFile).write(offsets);
-        
expect(stateDirectory.checkpointFileFor(task)).andReturn(checkpointFile);
+        
lenient().when(stateDirectory.checkpointFileFor(task)).thenReturn(checkpointFile);

Review Comment:
   This is lenient because 
`shouldComputeOffsetSumForRestoringActiveTaskWithStateUpdater` and 
`shouldComputeOffsetSumForRestoringStandbyTaskWithStateUpdater` do not invoke 
this method. I am equally happy to explicitly mock the required calls only 
within those two tests to maintain the same strictness. 



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