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


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java:
##########
@@ -1300,28 +1229,16 @@ public void 
shouldCloseActiveTasksWhenHandlingLostTasks() throws Exception {
 
         // `handleAssignment`
         expectRestoreToBeCompleted(consumer, changeLogReader);
-        expect(activeTaskCreator.createTasks(anyObject(), 
eq(taskId00Assignment))).andStubReturn(singletonList(task00));
-        
expect(standbyTaskCreator.createTasks(eq(taskId01Assignment))).andStubReturn(singletonList(task01));
-        topologyBuilder.addSubscribedTopicsFromAssignment(anyObject(), 
anyString());
-        expectLastCall().anyTimes();
+        when(activeTaskCreator.createTasks(any(), 
eq(taskId00Assignment))).thenReturn(singletonList(task00));
+        
when(standbyTaskCreator.createTasks(eq(taskId01Assignment))).thenReturn(singletonList(task01));
 
+        // The second attempt will return empty tasks.
         makeTaskFolders(taskId00.toString(), taskId01.toString());
         expectLockObtainedFor(taskId00, taskId01);
 
-        // The second attempt will return empty tasks.
-        makeTaskFolders();

Review Comment:
   I have altered the makeTaskFolders function to take the second call into 
account.
   
   Before:
   ```
   
expect(stateDirectory.listNonEmptyTaskDirectories()).andReturn(taskFolders).once();
   ```
   After:
   ```
   
when(stateDirectory.listNonEmptyTaskDirectories()).thenReturn(taskFolders).thenReturn(Collections.emptyList());
   ```
   
   As far as I understand subsequent calls for stubbing in Mockito overwrite 
previous ones, so I cannot do exactly what was done with EasyMock.



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