chickenchickenlove commented on code in PR #23742:
URL: https://github.com/apache/kafka/pull/23742#discussion_r4370843575


##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/modern/AssignmentTest.java:
##########
@@ -17,72 +17,140 @@
 package org.apache.kafka.coordinator.group.modern;
 
 import org.apache.kafka.common.Uuid;
-import org.apache.kafka.coordinator.group.assignor.AssignorHelpers;
 import 
org.apache.kafka.coordinator.group.generated.ConsumerGroupTargetAssignmentMemberValue;
+import 
org.apache.kafka.coordinator.group.generated.ShareGroupTargetAssignmentMemberValue;
 
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import static 
org.apache.kafka.coordinator.group.AssignmentTestUtil.mkAssignment;
 import static 
org.apache.kafka.coordinator.group.AssignmentTestUtil.mkTopicAssignment;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class AssignmentTest {
 
     @Test
     public void testPartitionsCannotBeNull() {
-        assertThrows(NullPointerException.class, () -> new Assignment(null));
+        assertThrows(NullPointerException.class, () -> Assignment.of(null));
+        assertThrows(NullPointerException.class, () -> 
Assignment.copyOf(null));
     }
 
     @Test
-    public void testPartitionsImmutable() {
-        // Assignments are used as input to assignors, which expect to receive 
immutable
-        // assignment maps, otherwise they will be modified in place.
+    public void testCopyOfPartitionsImmutable() {
+        Uuid topicId = Uuid.randomUuid();
         Map<Uuid, Set<Integer>> partitions = new HashMap<>();
-        partitions.put(Uuid.randomUuid(), Set.of(1, 2, 3));
-        Assignment assignment = new Assignment(partitions);
-        assertTrue(AssignorHelpers.isImmutableMap(assignment.partitions()));

Review Comment:
   I've moved this test code to `testOfWrapsMapAndReusesPartitionSets()` which 
will be introduced in the next commit!



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