vincent81jiang commented on a change in pull request #11864:
URL: https://github.com/apache/kafka/pull/11864#discussion_r823215546



##########
File path: 
core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala
##########
@@ -2483,6 +2483,20 @@ class AuthorizerIntegrationTest extends BaseRequestTest {
     }
   }
 
+
+  @ParameterizedTest
+  @ValueSource(strings = Array("zk", "kraft"))
+  def testCreateAndCloseConsumerWithNoAccess(quorum: String): Unit = {
+    val consumer = createConsumer()
+    try {
+      // Close consumer without consuming anything. close() call should pass 
successfully and throw no exception.
+      consumer.close()
+    } catch {
+      case e: Throwable =>
+        fail(s"Exception not expected on closing consumer: $e")
+    }

Review comment:
       @showuon, sounds good. Updated to use assertDoesNotThrow. 
   
   Note: I cannot pass "() => consumer.close()" directly to assertDoesNotThrow 
because it causes compile error:
   ```
   ambiguous reference to overloaded definition,
   both method assertDoesNotThrow in class Assertions of type [T](x$1: 
org.junit.jupiter.api.function.ThrowingSupplier[T], x$2: String): T
   and  method assertDoesNotThrow in class Assertions of type (x$1: 
org.junit.jupiter.api.function.Executable, x$2: String): Unit
   match argument types (() => Unit,String)
   ```




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