aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-09-12 17:13:21 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-09-13 13:27:18 +0200
commit516ba9b922f4dab9f72077ee5ebf6eebda6c0d3a (patch)
treea393440f15a5a956997fff8a8641a7a5ef647aa9 /src/test/java
parentec22be60678b5ff5138e5ba6d3bba2fe7a5a5fc1 (diff)
downloadsonar-scanner-cli-516ba9b922f4dab9f72077ee5ebf6eebda6c0d3a.tar.gz
sonar-scanner-cli-516ba9b922f4dab9f72077ee5ebf6eebda6c0d3a.zip
SQSCANNER-28 Support sonar.scanner.skip without connecting to server
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/sonarsource/scanner/cli/MainTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/org/sonarsource/scanner/cli/MainTest.java b/src/test/java/org/sonarsource/scanner/cli/MainTest.java
index 06adc9d..450d0a7 100644
--- a/src/test/java/org/sonarsource/scanner/cli/MainTest.java
+++ b/src/test/java/org/sonarsource/scanner/cli/MainTest.java
@@ -29,6 +29,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.sonarsource.scanner.api.EmbeddedScanner;
+import org.sonarsource.scanner.api.ScanProperties;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.any;
@@ -150,6 +151,23 @@ public class MainTest {
inOrder.verify(runnerFactory, times(1)).create(p);
inOrder.verify(exit, times(1)).exit(Exit.SUCCESS);
}
+
+ @Test
+ public void should_skip() throws IOException {
+ Properties p = new Properties();
+ p.setProperty(ScanProperties.SKIP, "true");
+ when(conf.properties()).thenReturn(p);
+
+ Main main = new Main(exit, cli, conf, runnerFactory, logs);
+ main.execute();
+
+ verify(logs).info("SonarQube Scanner analysis skipped");
+ InOrder inOrder = Mockito.inOrder(exit, runnerFactory);
+
+ inOrder.verify(exit, times(1)).exit(Exit.SUCCESS);
+ inOrder.verify(runnerFactory, times(1)).create(p);
+ inOrder.verify(exit, times(1)).exit(Exit.SUCCESS);
+ }
@Test
public void shouldLogServerVersion() throws IOException {