AndrewJSchofield commented on code in PR #19026:
URL: https://github.com/apache/kafka/pull/19026#discussion_r1995955869
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/modern/SubscribedTopicMetadataTest.java:
##########
@@ -79,4 +80,30 @@ public void testEquals() {
topicMetadataMap2.put(topicId, new TopicMetadata(topicId, "newTopic",
5));
assertNotEquals(new SubscribedTopicDescriberImpl(topicMetadataMap2),
subscribedTopicMetadata);
}
+
+ @Test
+ public void testAssignablePartitions() {
+ // null allow map (all partitions assignable)
+ subscribedTopicMetadata = new
SubscribedTopicDescriberImpl(topicMetadataMap, null);
+ String t1Name = "t1";
+ Uuid t1Id = Uuid.randomUuid();
+ topicMetadataMap.put(t1Id, new TopicMetadata(t1Id, t1Name, 5));
+ assertEquals(Set.of(0, 1, 2, 3, 4),
subscribedTopicMetadata.assignablePartitions(t1Id));
+
+ // empty allow map (nothing assignable)
+ subscribedTopicMetadata = new
SubscribedTopicDescriberImpl(topicMetadataMap, Map.of());
+ assertEquals(Set.of(),
subscribedTopicMetadata.assignablePartitions(t1Id));
+
+ // few assignable partitions
+ subscribedTopicMetadata = new
SubscribedTopicDescriberImpl(topicMetadataMap, Map.of(
Review Comment:
nit: Slightly odd indentation with the line break in the middle of the
deepest method call. Similar on line 104.
--
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]