divijvaidya commented on code in PR #14583:
URL: https://github.com/apache/kafka/pull/14583#discussion_r1367044096


##########
core/src/test/scala/unit/kafka/utils/CoreUtilsTest.scala:
##########
@@ -43,6 +43,18 @@ class CoreUtilsTest extends Logging {
     CoreUtils.swallow(throw new KafkaException("test"), this, Level.INFO)
   }
 
+  @Test
+  def testSwallowLogging(): Unit = {
+    var loggedMessage: Option[String] = None
+    val testLogging: Logging = new Logging {
+      override def info(msg: => String, e: => Throwable): Unit = {
+        loggedMessage = Some(msg)
+      }
+    }
+    CoreUtils.swallow(throw new KafkaException("test"), testLogging, 
Level.INFO)

Review Comment:
   alternatively, you can `spy` Logging and then verify invocation of 
testLogging.info. The advantage of that approach is that we won't have to 
override the logging behaviour.
   
   Also, could you check nearby methods in this class and see if any other 
method requires a similar test? Might as well bundle them together in this PR 
while we are at it.



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