aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/sonarsource/scanner/cli/LogsTest.java
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2024-04-30 14:59:03 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2024-05-03 13:07:43 +0200
commitb04cd6ba08a93a88553c1dfceaa725ced1ba381c (patch)
tree762512e8d5a70bd6981706c5d779a982c57ad75a /src/test/java/org/sonarsource/scanner/cli/LogsTest.java
parentfd82dd7b5a54d2042da17baff7088329123797ac (diff)
downloadsonar-scanner-cli-b04cd6ba08a93a88553c1dfceaa725ced1ba381c.tar.gz
sonar-scanner-cli-b04cd6ba08a93a88553c1dfceaa725ced1ba381c.zip
SCANCLI-145 Update to the scanner library 3.0
Diffstat (limited to 'src/test/java/org/sonarsource/scanner/cli/LogsTest.java')
-rw-r--r--src/test/java/org/sonarsource/scanner/cli/LogsTest.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java
index e664365..82a26ad 100644
--- a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java
+++ b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java
@@ -25,7 +25,10 @@ import org.junit.Test;
import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.sonarsource.scanner.lib.LogOutput;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -89,4 +92,37 @@ public class LogsTest {
logs.debug("debug");
verifyNoMoreInteractions(stdOut, stdErr);
}
+
+ @Test
+ public void should_forward_logs() {
+ var mockedLogs = mock(Logs.class);
+ var logOutput = new Logs.LogOutputAdapter(mockedLogs);
+
+ String msg = "test";
+
+ logOutput.log(msg, LogOutput.Level.DEBUG);
+ verify(mockedLogs).debug(msg);
+ verifyNoMoreInteractions(mockedLogs);
+ reset(mockedLogs);
+
+ logOutput.log(msg, LogOutput.Level.INFO);
+ verify(mockedLogs).info(msg);
+ verifyNoMoreInteractions(mockedLogs);
+ reset(mockedLogs);
+
+ logOutput.log(msg, LogOutput.Level.ERROR);
+ verify(mockedLogs).error(msg);
+ verifyNoMoreInteractions(mockedLogs);
+ reset(mockedLogs);
+
+ logOutput.log(msg, LogOutput.Level.WARN);
+ verify(mockedLogs).warn(msg);
+ verifyNoMoreInteractions(mockedLogs);
+ reset(mockedLogs);
+
+ logOutput.log(msg, LogOutput.Level.TRACE);
+ verify(mockedLogs).debug(msg);
+ verifyNoMoreInteractions(mockedLogs);
+ reset(mockedLogs);
+ }
}