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


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java:
##########
@@ -1961,10 +1920,10 @@ public void postCommit(final boolean enforceCheckpoint) 
{
         };
 
         // `handleAssignment`
-        expectRestoreToBeCompleted(consumer);
+        expectAssignmentToBeCalled(consumer);
         when(activeTaskCreator.createTasks(any(), 
Mockito.eq(taskId00Assignment))).thenReturn(singletonList(task00));
-        expect(consumer.assignment()).andReturn(taskId00Partitions);
-        replay(consumer);
+        final Set<TopicPartition> partitions = union(HashSet::new, 
taskId00Partitions);
+        when(consumer.assignment()).thenReturn(partitions);

Review Comment:
   ~~Because I couldn't figure out a better way to create a set with only one 
element and Collections does not have a singletonSet 😞 ~~



##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java:
##########
@@ -1961,10 +1920,10 @@ public void postCommit(final boolean enforceCheckpoint) 
{
         };
 
         // `handleAssignment`
-        expectRestoreToBeCompleted(consumer);
+        expectAssignmentToBeCalled(consumer);
         when(activeTaskCreator.createTasks(any(), 
Mockito.eq(taskId00Assignment))).thenReturn(singletonList(task00));
-        expect(consumer.assignment()).andReturn(taskId00Partitions);
-        replay(consumer);
+        final Set<TopicPartition> partitions = union(HashSet::new, 
taskId00Partitions);
+        when(consumer.assignment()).thenReturn(partitions);

Review Comment:
   ~~Because I couldn't figure out a better way to create a set with only one 
element and Collections does not have a singletonSet~~ 😞



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