Skip to content

Commit 0679a2b

Browse files
committed
Dedicated test scopes for interpolated messages
1 parent f917dbd commit 0679a2b

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/test/scala/com/typesafe/scalalogging/LoggerSpec.scala

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,25 @@ class LoggerSpec extends WordSpec with Matchers with MockitoSugar {
4343
logger.error(msg)
4444
verify(underlying, never).error(anyString)
4545
}
46+
}
47+
48+
"Calling error with an interpolated message" should {
4649

47-
"call the underlying logger's error method with arguments if the error level is enabled and string is interpolated" in {
50+
"call the underlying logger's error method with arguments if the error level is enabled" in {
4851
val f = fixture(_.isErrorEnabled, true)
4952
import f._
5053
logger.error(s"msg $arg1 $arg2 $arg3")
5154
verify(underlying).error("msg {} {} {}", arg1, arg2, arg3)
5255
}
5356

54-
"call the underlying logger's error method with two arguments if the error level is enabled and string is interpolated" in {
57+
"call the underlying logger's error method with two arguments if the error level is enabled" in {
5558
val f = fixture(_.isErrorEnabled, true)
5659
import f._
5760
logger.error(s"msg $arg1 $arg2")
5861
verify(underlying).error("msg {} {}", List(arg1, arg2): _*)
5962
}
6063

61-
"call the underlying logger's error method with the string representation of interpolated AnyVal arguments" in {
64+
"call the underlying logger's error method with the string representation AnyVal arguments" in {
6265
val f = fixture(_.isErrorEnabled, true)
6366
import f._
6467
logger.error(s"msg ${1}")
@@ -132,8 +135,10 @@ class LoggerSpec extends WordSpec with Matchers with MockitoSugar {
132135
logger.warn(msg)
133136
verify(underlying, never).warn(anyString)
134137
}
138+
}
139+
"Calling warn with an interpolated message" should {
135140

136-
"call the underlying logger's warn method if the warn level is enabled and string is interpolated" in {
141+
"call the underlying logger's warn method if the warn level is enabled" in {
137142
val f = fixture(_.isWarnEnabled, true)
138143
import f._
139144
logger.warn(s"msg $arg1 $arg2 $arg3")
@@ -200,8 +205,10 @@ class LoggerSpec extends WordSpec with Matchers with MockitoSugar {
200205
logger.info(msg)
201206
verify(underlying, never).info(anyString)
202207
}
208+
}
209+
"Calling info with an interpolated message" should {
203210

204-
"call the underlying logger's info method if the info level is enabled and string is interpolated" in {
211+
"call the underlying logger's info method if the info level is enabled" in {
205212
val f = fixture(_.isInfoEnabled, true)
206213
import f._
207214
logger.info(s"msg $arg1 $arg2 $arg3")
@@ -268,15 +275,17 @@ class LoggerSpec extends WordSpec with Matchers with MockitoSugar {
268275
logger.debug(msg)
269276
verify(underlying, never).debug(anyString)
270277
}
278+
}
279+
"Calling debug with an interpolated message" should {
271280

272-
"call the underlying logger's debug method if the debug level is enabled and string is interpolated" in {
281+
"call the underlying logger's debug method if the debug level is enabled" in {
273282
val f = fixture(_.isDebugEnabled, true)
274283
import f._
275284
logger.debug(s"msg $arg1 $arg2 $arg3")
276285
verify(underlying).debug("msg {} {} {}", arg1, arg2, arg3)
277286
}
278287

279-
"call the underlying logger's debug method with the string representation of interpolated AnyVal arguments" in {
288+
"call the underlying logger's debug method with the string representation of AnyVal arguments" in {
280289
val f = fixture(_.isDebugEnabled, true)
281290
import f._
282291
logger.debug(s"msg ${1}")
@@ -343,8 +352,10 @@ class LoggerSpec extends WordSpec with Matchers with MockitoSugar {
343352
logger.trace(msg)
344353
verify(underlying, never).trace(anyString)
345354
}
355+
}
356+
"Calling trace with an interpolated message" should {
346357

347-
"call the underlying logger's trace method if the trace level is enabled and string is interpolated" in {
358+
"call the underlying logger's trace method if the trace level is enabled" in {
348359
val f = fixture(_.isTraceEnabled, true)
349360
import f._
350361
logger.trace(s"msg $arg1 $arg2 $arg3")

0 commit comments

Comments
 (0)