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


##########
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:
   One small suggestion here. It seems like we initialize 
`List[DeletableGroupResult]` for these test cases here so maybe to simplify the 
test code a bit we can have a method that converts `Map[String, Errors]` (where 
group id is the key) into `List[DeletableGroupResult]`. 



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