chia7712 commented on code in PR #16601:
URL: https://github.com/apache/kafka/pull/16601#discussion_r1679946355


##########
core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala:
##########
@@ -1881,14 +1882,14 @@ class ControllerIntegrationTest extends 
QuorumTestHarness {
       TestUtils.waitUntilTrue(() => !controller.isActive, "Controller fails to 
resign")
 
       // Expect to capture the ControllerMovedException in the log of 
ControllerEventThread
-      val event = appender.getMessages.find(e => e.getLevel == Level.INFO
-        && e.getThrowableInformation != null
-        && 
e.getThrowableInformation.getThrowable.getClass.getName.equals(classOf[ControllerMovedException].getName))
-      assertTrue(event.isDefined)
+      val event = appender.getEvents.stream().filter(e => e.getLevel == 
Level.INFO.toString
+        && e.getThrowableClassName.isPresent

Review Comment:
   ditto



##########
core/src/test/scala/unit/kafka/admin/AclCommandTest.scala:
##########
@@ -217,17 +217,17 @@ class AclCommandTest extends QuorumTestHarness with 
Logging {
     createServer(Some(adminClientConfig))
 
     val appender = LogCaptureAppender.createAndRegister()
-    val previousLevel = 
LogCaptureAppender.setClassLoggerLevel(classOf[AppInfoParser], Level.WARN)
+    appender.setClassLoggerToWarn(classOf[AppInfoParser])
     try {
       testAclCli(adminArgs)
     } finally {
-      LogCaptureAppender.setClassLoggerLevel(classOf[AppInfoParser], 
previousLevel)
-      LogCaptureAppender.unregister(appender)
+      appender.close()
     }
-    val warning = appender.getMessages.find(e => e.getLevel == Level.WARN &&
-      e.getThrowableInformation != null &&
-      e.getThrowableInformation.getThrowable.getClass.getName == 
classOf[InstanceAlreadyExistsException].getName)
-    assertFalse(warning.isDefined, "There should be no warnings about multiple 
registration of mbeans")
+    val warning = appender.getEvents.stream.filter(e => e.getLevel == 
Level.WARN.toString &&
+      e.getThrowableClassName.isPresent &&

Review Comment:
   `e.getThrowableClassName.filter(_ 
==classOf[InstanceAlreadyExistsException].getName).isPresent)`



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