diff options
author | Michal Duda <44705056+michal-duda-sonarsource@users.noreply.github.com> | 2019-01-08 12:14:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-08 12:14:26 +0100 |
commit | b600d744553080a8245988c5c07ebdf9701d8e53 (patch) | |
tree | 352c0cff959c44473e51827294adc400a962ad9d /src | |
parent | 260bd2ffa46f576b2e617f2c3df2c07c1437ffc3 (diff) | |
download | sonar-scanner-cli-b600d744553080a8245988c5c07ebdf9701d8e53.tar.gz sonar-scanner-cli-b600d744553080a8245988c5c07ebdf9701d8e53.zip |
SQSCANNER-54 don't print warnings to stderr (#57)
Redirect warnings to stdout instead of stderr.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/sonarsource/scanner/cli/Logs.java | 2 | ||||
-rw-r--r-- | src/test/java/org/sonarsource/scanner/cli/LogsTest.java | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Logs.java b/src/main/java/org/sonarsource/scanner/cli/Logs.java index 87794d6..a5cbcc8 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Logs.java +++ b/src/main/java/org/sonarsource/scanner/cli/Logs.java @@ -56,7 +56,7 @@ public class Logs { } public void warn(String message) { - print(stdErr, "WARN: " + message); + print(stdOut, "WARN: " + message); } public void error(String message) { diff --git a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java index 385b329..5e1e0e3 100644 --- a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java @@ -19,16 +19,15 @@ */ package org.sonarsource.scanner.cli; +import java.io.PrintStream; import org.junit.Before; import org.junit.Test; import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.sonarsource.scanner.cli.Logs; -import java.io.PrintStream; -import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; public class LogsTest { @Mock @@ -51,19 +50,19 @@ public class LogsTest { verify(stdOut).println("INFO: info"); verifyNoMoreInteractions(stdOut, stdErr); } - + @Test public void testWarn() { logs.warn("warn"); - verify(stdErr).println("WARN: warn"); + verify(stdOut).println("WARN: warn"); verifyNoMoreInteractions(stdOut, stdErr); } - + @Test public void testWarnWithTimestamp() { logs.setDebugEnabled(true); logs.warn("warn"); - verify(stdErr).println(Matchers.matches("\\d\\d:\\d\\d:\\d\\d.\\d\\d\\d WARN: warn")); + verify(stdOut).println(Matchers.matches("\\d\\d:\\d\\d:\\d\\d.\\d\\d\\d WARN: warn")); verifyNoMoreInteractions(stdOut, stdErr); } |