chia7712 commented on code in PR #16601:
URL: https://github.com/apache/kafka/pull/16601#discussion_r1684192782
##########
core/src/test/scala/unit/kafka/admin/AclCommandTest.scala:
##########
@@ -217,17 +217,16 @@ class AclCommandTest extends QuorumTestHarness with
Logging {
createServer(Some(adminClientConfig))
val appender = LogCaptureAppender.createAndRegister()
- val previousLevel =
LogCaptureAppender.setClassLoggerLevel(classOf[AppInfoParser], Level.WARN)
+ appender.setClassLogger(classOf[AppInfoParser], Level.WARN)
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 &&
Review Comment:
Could you please decorate it a bit?
```scala
assertEquals(0, appender.getEvents.stream
.filter(e => e.getLevel == Level.WARN.toString)
.filter(_.getThrowableClassName.filter(_ ==
classOf[InstanceAlreadyExistsException].getName).isPresent())
.count(), "There should be no warnings about multiple registration of
mbeans")
```
##########
core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala:
##########
@@ -1881,14 +1882,13 @@ 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
Review Comment:
ditto
--
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]