aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-09-15 11:56:46 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-09-15 11:58:09 +0200
commit12c373fad66da9ccb9cfb2ce7e3c5d2de4f60fe2 (patch)
treeb7c29efe7b57efd74939950f2587092d2b0f6086 /src/test
parent7a0e70b84e3d3b97dca3db1381d6c64905b9ea6b (diff)
downloadsonar-scanner-cli-12c373fad66da9ccb9cfb2ce7e3c5d2de4f60fe2.tar.gz
sonar-scanner-cli-12c373fad66da9ccb9cfb2ce7e3c5d2de4f60fe2.zip
SQSCANNER-30 Add timestamp to logs in debug/verbose
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/sonarsource/scanner/cli/LogsTest.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java
index c3b5e32..cc8ab38 100644
--- a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java
+++ b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java
@@ -21,6 +21,7 @@ package org.sonarsource.scanner.cli;
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;
@@ -50,19 +51,19 @@ public class LogsTest {
verify(stdOut).println("INFO: info");
verifyNoMoreInteractions(stdOut, stdErr);
}
-
+
@Test
public void testError() {
Exception e = new NullPointerException("exception");
logs.setDisplayStackTrace(false);
logs.error("error1");
verify(stdErr).println("ERROR: error1");
-
+
logs.error("error2", e);
verify(stdErr).println("ERROR: error2");
-
+
verifyNoMoreInteractions(stdOut, stdErr);
-
+
logs.setDisplayStackTrace(true);
logs.error("error3", e);
verify(stdErr).println("ERROR: error3");
@@ -74,7 +75,7 @@ public class LogsTest {
logs.setDebugEnabled(true);
logs.debug("debug");
- verify(stdOut).println("DEBUG: debug");
+ verify(stdOut).println(Matchers.matches("\\d\\d:\\d\\d:\\d\\d.\\d\\d\\d DEBUG: debug$"));
logs.setDebugEnabled(false);
logs.debug("debug");