diff options
Diffstat (limited to 'src/test/java/org/sonarsource/scanner/cli/MainTest.java')
-rw-r--r-- | src/test/java/org/sonarsource/scanner/cli/MainTest.java | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/test/java/org/sonarsource/scanner/cli/MainTest.java b/src/test/java/org/sonarsource/scanner/cli/MainTest.java index dc1013b..fe532af 100644 --- a/src/test/java/org/sonarsource/scanner/cli/MainTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/MainTest.java @@ -90,7 +90,7 @@ public class MainTest { main.execute(); verify(exit).exit(Exit.INTERNAL_ERROR); - verify(logs).error("Error during SonarQube Scanner execution", e); + verify(logs).error("Error during SonarScanner execution", e); } @Test @@ -108,7 +108,7 @@ public class MainTest { verify(runner).start(); verify(runner, never()).execute(any()); verify(exit).exit(Exit.INTERNAL_ERROR); - verify(logs).error("Error during SonarQube Scanner execution", e); + verify(logs).error("Error during SonarScanner execution", e); } @Test @@ -116,8 +116,8 @@ public class MainTest { Exception e = createException(false); testException(e, false, false, Exit.INTERNAL_ERROR); - verify(logs).error("Error during SonarQube Scanner execution", e); - verify(logs).error("Re-run SonarQube Scanner using the -X switch to enable full debug logging."); + verify(logs).error("Error during SonarScanner execution", e); + verify(logs).error("Re-run SonarScanner using the -X switch to enable full debug logging."); } @Test @@ -126,11 +126,11 @@ public class MainTest { testException(e, false, false, Exit.USER_ERROR); verify(logs, times(5)).error(anyString()); - verify(logs).error("Error during SonarQube Scanner execution"); + verify(logs).error("Error during SonarScanner execution"); verify(logs).error("my message"); verify(logs).error("Caused by: A functional cause"); verify(logs).error(""); - verify(logs).error("Re-run SonarQube Scanner using the -X switch to enable full debug logging."); + verify(logs).error("Re-run SonarScanner using the -X switch to enable full debug logging."); } @Test @@ -139,7 +139,7 @@ public class MainTest { testException(e, false, true, Exit.USER_ERROR); verify(logs, times(4)).error(anyString()); - verify(logs).error("Error during SonarQube Scanner execution"); + verify(logs).error("Error during SonarScanner execution"); verify(logs).error("my message"); verify(logs).error("Caused by: A functional cause"); verify(logs).error(""); @@ -151,7 +151,7 @@ public class MainTest { testException(e, true, false, Exit.USER_ERROR); verify(logs, times(1)).error(anyString(), any(Throwable.class)); - verify(logs).error("Error during SonarQube Scanner execution", e); + verify(logs).error("Error during SonarScanner execution", e); } @Test @@ -160,7 +160,7 @@ public class MainTest { testException(e, true, true, Exit.USER_ERROR); verify(logs, times(1)).error(anyString(), any(Throwable.class)); - verify(logs).error("Error during SonarQube Scanner execution", e); + verify(logs).error("Error during SonarScanner execution", e); } @Test @@ -168,8 +168,8 @@ public class MainTest { Exception e = createException(false); testException(e, true, false, Exit.INTERNAL_ERROR); - verify(logs).error("Error during SonarQube Scanner execution", e); - verify(logs, never()).error("Re-run SonarQube Scanner using the -X switch to enable full debug logging."); + verify(logs).error("Error during SonarScanner execution", e); + verify(logs, never()).error("Re-run SonarScanner using the -X switch to enable full debug logging."); } private void testException(Exception e, boolean debugEnabled, boolean isEmbedded, int expectedExitCode) { @@ -222,7 +222,7 @@ public class MainTest { Main main = new Main(exit, cli, conf, scannerFactory, logs); main.execute(); - verify(logs).info("SonarQube Scanner analysis skipped"); + verify(logs).info("SonarScanner analysis skipped"); InOrder inOrder = Mockito.inOrder(exit, scannerFactory); inOrder.verify(exit, times(1)).exit(Exit.SUCCESS); @@ -239,7 +239,18 @@ public class MainTest { Main main = new Main(exit, cli, conf, scannerFactory, logs); main.execute(); - verify(logs).info("SonarQube server 5.5"); + verify(logs).info("Analyzing on SonarQube server 5.5"); + } + + @Test + public void should_log_SonarCloud_server() { + Properties p = new Properties(); + when(conf.properties()).thenReturn(p); + when(conf.isSonarCloud(null)).thenReturn(true); + + Main main = new Main(exit, cli, conf, scannerFactory, logs); + main.execute(); + verify(logs).info("Analyzing on SonarCloud"); } @Test |