squah-confluent commented on code in PR #23505:
URL: https://github.com/apache/kafka/pull/23505#discussion_r4039380931


##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/modern/TopicIdsTest.java:
##########
@@ -168,6 +170,53 @@ public void testIteratorOneTopicConversionFails() {
         assertEquals(expectedIds, actualIds);
     }
 
+    @Test
+    public void testToArray() {
+        var fooUuid = Uuid.randomUuid();
+        var barUuid = Uuid.randomUuid();
+        var bazUuid = Uuid.randomUuid();
+        var metadataImage = new KRaftCoordinatorMetadataImage(
+            new MetadataImageBuilder()
+                .addTopic(fooUuid, "foo", 3)
+                .addTopic(barUuid, "bar", 3)
+                .addTopic(bazUuid, "baz", 3)
+                .build()
+        );
+
+        var topicIds = new TopicIds(Set.of("foo", "bar", "baz"), 
metadataImage);
+
+        assertEquals(Set.of(fooUuid, barUuid, bazUuid), 
Set.of(topicIds.toArray()));
+        assertEquals(Set.of(fooUuid, barUuid, bazUuid), 
Set.of(topicIds.toArray(new Uuid[0])));
+
+        // An array which is large enough is filled in place, and the element 
after the last
+        // one is set to null.
+        var large = new Uuid[4];
+        assertSame(large, topicIds.toArray(large));
+        assertEquals(Set.of(fooUuid, barUuid, bazUuid), Set.of(large[0], 
large[1], large[2]));
+        assertNull(large[3]);
+    }
+
+    @Test
+    public void testToArrayOneTopicConversionFails() {
+        var fooUuid = Uuid.randomUuid();

Review Comment:
   ```suggestion
       public void testToArrayOneTopicConversionFails() {
           // topic 'qux' only exists as topic id.
           // topic 'baz' only exists as topic name.
           var fooUuid = Uuid.randomUuid();
   ```
   Let's follow the comment pattern in the other `OneTopicConversionFails` tests



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