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


##########
core/src/test/scala/unit/kafka/coordinator/group/GroupCoordinatorAdapterTest.scala:
##########
@@ -135,4 +134,48 @@ class GroupCoordinatorAdapterTest {
     assertEquals(expectedData, future.get())
   }
 
+  @Test
+  def testListGroups(): Unit = {
+    testListGroups(null, Set.empty)
+    testListGroups(List(), Set.empty)
+    testListGroups(List("Stable"), Set("Stable"))
+  }
+
+  def testListGroups(
+    statesFilter: List[String],
+    expectedStatesFilter: Set[String]
+  ): Unit = {
+    val groupCoordinator = mock(classOf[GroupCoordinator])
+    val adapter = new GroupCoordinatorAdapter(groupCoordinator)
+
+    val ctx = makeContext(ApiKeys.LIST_GROUPS.latestVersion)
+    val data = new ListGroupsRequestData()
+      .setStatesFilter(statesFilter.asJava)
+
+    when(groupCoordinator.handleListGroups(expectedStatesFilter)).thenReturn {
+      (Errors.NOT_COORDINATOR, List(
+        GroupOverview("group1", "protocol1", "Stable"),
+        GroupOverview("group2", "qwerty", "Empty")

Review Comment:
   I agree that this is a tad weird. However, the filtering is not done by 
`GroupCoordinatorAdapter` so the test only verifies that inputs/outputs are 
correctly translated here. In practice, we would not have an error and a list 
of groups as well.



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