]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
SQSCANNER-54 don't print warnings to stderr (#57)
authorMichal Duda <44705056+michal-duda-sonarsource@users.noreply.github.com>
Tue, 8 Jan 2019 11:14:26 +0000 (12:14 +0100)
committerGitHub <noreply@github.com>
Tue, 8 Jan 2019 11:14:26 +0000 (12:14 +0100)
Redirect warnings to stdout instead of stderr.

src/main/java/org/sonarsource/scanner/cli/Logs.java
src/test/java/org/sonarsource/scanner/cli/LogsTest.java

index 87794d6e95e55ee7de4e9c19ccca977ec95f0500..a5cbcc845cf9e06962059bb54feb4300fe36c159 100644 (file)
@@ -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) {
index 385b329644af86d7c4c88e26a22f30d3f6c3346e..5e1e0e355f0ce8ba1723fb3ec4df9f9d07057a43 100644 (file)
  */
 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);
   }