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


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessorTest.java:
##########
@@ -145,6 +148,39 @@ public void testResetPositionsProcess() {
         
verify(applicationEventProcessor).process(any(ResetPositionsEvent.class));
     }
 
+    @ParameterizedTest
+    @ValueSource(booleans = {true, false})
+    public void testAssignmentChangeEvent(boolean withGroupId) {
+        final long currentTimeMs = 12345;
+        AssignmentChangeEvent event = new AssignmentChangeEvent(currentTimeMs, 
12345, Collections.emptyList());
+
+        setupProcessor(withGroupId);
+        doReturn(true).when(subscriptionState).assignFromUser(any());
+        processor.process(event);
+        if (withGroupId) {
+            verify(commitRequestManager).updateAutoCommitTimer(currentTimeMs);
+            verify(commitRequestManager).maybeAutoCommitAsync();
+        } else {
+            verify(commitRequestManager, 
never()).updateAutoCommitTimer(currentTimeMs);
+            verify(commitRequestManager, never()).maybeAutoCommitAsync();
+        }
+        verify(metadata).requestUpdateForNewTopics();

Review Comment:
   let's `verify(subscriptionState).assignFromUser` to ensure the call to 
update the subscription state actually happens. We could even validate the 
param because we know it (if we provide a set of partitions to the event in ln 
155,  then the assignFromUser call should receive the same set of partitions)  



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