From ecf7cb09d4bce389b615257d3323ada0840100e8 Mon Sep 17 00:00:00 2001 From: fkrzywka Date: Wed, 13 Jun 2018 15:02:40 +0200 Subject: Start DCAE App Simulator from command line Closes ONAP-377 Change-Id: Iab959835dfafcfcfaf1322ead4ea83eff1e9284c Signed-off-by: fkrzywka Issue-ID: DCAEGEN2-601 --- .../collectors/veshv/utils/logging/LoggerTest.kt | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'hv-collector-utils/src/test/kotlin') diff --git a/hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt b/hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt index be521970..b98131cc 100644 --- a/hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt +++ b/hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt @@ -181,6 +181,50 @@ object LoggerTest : Spek({ } } + describe("error levels") { + it("should log message") { + cut.error(message) + verify(slf4jLogger).error(message) + } + + it("should log message with exception") { + cut.error(message, exception) + verify(slf4jLogger).error(message, exception) + } + + describe("lazy logging message") { + + it("should log when debug is ON") { + whenever(slf4jLogger.isErrorEnabled).thenReturn(true) + cut.error { message } + verify(slf4jLogger).isErrorEnabled + verify(slf4jLogger).error(message) + } + + it("should not log when debug is OFF") { + whenever(slf4jLogger.isErrorEnabled).thenReturn(false) + cut.error { message } + verify(slf4jLogger).isErrorEnabled + } + } + + describe("lazy logging message with exception") { + + it("should log when debug is ON") { + whenever(slf4jLogger.isErrorEnabled).thenReturn(true) + cut.error(exception) { message } + verify(slf4jLogger).isErrorEnabled + verify(slf4jLogger).error(message, exception) + } + + it("should not log when debug is OFF") { + whenever(slf4jLogger.isErrorEnabled).thenReturn(false) + cut.error(exception) { message } + verify(slf4jLogger).isErrorEnabled + } + } + } + } }) -- cgit 1.2.3-korg