From cd4e13b3e45efa51e991378b3f41ad89d063fa47 Mon Sep 17 00:00:00 2001 From: prateekatknoldus Date: Sun, 16 Jan 2022 23:31:54 +0530 Subject: [PATCH 1/2] updated LoggerTakingImplicitSpec with a testcase for getContext method --- .../typesafe/scalalogging/LoggerTakingImplicitSpec.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala b/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala index 0c21cea..967af17 100644 --- a/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala +++ b/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala @@ -376,6 +376,15 @@ class LoggerTakingImplicitSpec extends AnyWordSpec with Matchers with Varargs wi } } + "Calling getContext" should { + "call getContext on the underlying logger's CanLog" in { + val f = fixture(_.isErrorEnabled, isEnabled = true) + import f._ + logger.canLogEv.getContext + verify(canLogCorrelationId).getContext + } + } + private def fixture(p: Underlying => Boolean, isEnabled: Boolean, stubCanLog: Boolean = true) = new LoggerF(p, isEnabled, stubCanLog) private class LoggerF(p: Underlying => Boolean, isEnabled: Boolean, stubCanLog: Boolean = true) { implicit val correlationId: CorrelationId = CorrelationId("corrId") From 81def2dd475e852c78c746a7715806cc91ffa0ef Mon Sep 17 00:00:00 2001 From: prateekatknoldus Date: Sun, 16 Jan 2022 23:44:10 +0530 Subject: [PATCH 2/2] minor change --- .../com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala b/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala index 967af17..1ab3ecd 100644 --- a/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala +++ b/src/test/scala/com/typesafe/scalalogging/LoggerTakingImplicitSpec.scala @@ -380,8 +380,8 @@ class LoggerTakingImplicitSpec extends AnyWordSpec with Matchers with Varargs wi "call getContext on the underlying logger's CanLog" in { val f = fixture(_.isErrorEnabled, isEnabled = true) import f._ - logger.canLogEv.getContext - verify(canLogCorrelationId).getContext + logger.canLogEv.getContext() + verify(canLogCorrelationId).getContext() } }