dajac commented on code in PR #12858:
URL: https://github.com/apache/kafka/pull/12858#discussion_r1045524817


##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -1992,6 +1992,186 @@ class KafkaApisTest {
     testListOffsetFailedGetLeaderReplica(Errors.UNKNOWN_TOPIC_OR_PARTITION)
   }
 
+  @Test
+  def testHandleDeleteGroups(): Unit = {
+    val deleteGroupsRequest = new DeleteGroupsRequestData()
+      .setGroupsNames(List(
+        "group-1",
+        "group-2",
+        "group-3"
+      ).asJava)
+
+    val requestChannelRequest = buildRequest(new 
DeleteGroupsRequest.Builder(deleteGroupsRequest).build())
+
+    val expectedRequestContext = new GroupCoordinatorRequestContext(
+      ApiKeys.DELETE_GROUPS.latestVersion,
+      requestChannelRequest.context.clientId,
+      requestChannelRequest.context.clientAddress,
+      RequestLocal.NoCaching.bufferSupplier
+    )
+
+    val future = new 
CompletableFuture[DeleteGroupsResponseData.DeletableGroupResultCollection]()
+    when(newGroupCoordinator.deleteGroups(
+      ArgumentMatchers.eq(expectedRequestContext),
+      ArgumentMatchers.eq(List("group-1", "group-2", "group-3").asJava)
+    )).thenReturn(future)
+
+    createKafkaApis().handleDeleteGroupsRequest(
+      requestChannelRequest,
+      RequestLocal.NoCaching
+    )
+
+    val results = new 
DeleteGroupsResponseData.DeletableGroupResultCollection(List(

Review Comment:
   Thanks for your comment. I played a bit with your suggestion and I found 
that using a `Map` is not convenient here because the order matters. We could 
use an `LinkedHashMap` but that makes things less readable in my opinion. I 
think that I will stick to the current approach which is not that bad. We do 
this everywhere.



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