diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/sonarsource/scanner/cli/MainTest.java | 12 | ||||
-rw-r--r-- | src/test/java/org/sonarsource/scanner/cli/ScannerFactoryTest.java (renamed from src/test/java/org/sonarsource/scanner/cli/RunnerFactoryTest.java) | 17 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/test/java/org/sonarsource/scanner/cli/MainTest.java b/src/test/java/org/sonarsource/scanner/cli/MainTest.java index c0fbd65..4e5da4e 100644 --- a/src/test/java/org/sonarsource/scanner/cli/MainTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/MainTest.java @@ -32,7 +32,7 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.sonar.runner.api.EmbeddedRunner; +import org.sonarsource.scanner.api.EmbeddedScanner; import static org.fest.assertions.Assertions.assertThat; import static org.mockito.Matchers.any; @@ -54,9 +54,9 @@ public class MainTest { @Mock private Properties properties; @Mock - private RunnerFactory runnerFactory; + private ScannerFactory runnerFactory; @Mock - private EmbeddedRunner runner; + private EmbeddedScanner runner; @Mock private Logs logs; @@ -82,7 +82,7 @@ public class MainTest { @Test public void should_stop_on_error() { - EmbeddedRunner runner = mock(EmbeddedRunner.class); + EmbeddedScanner runner = mock(EmbeddedScanner.class); Exception e = new NullPointerException("NPE"); e = new IllegalStateException("Error", e); doThrow(e).when(runner).runAnalysis(any(Properties.class)); @@ -126,7 +126,7 @@ public class MainTest { when(cli.isDebugEnabled()).thenReturn(debugEnabled); when(cli.isDisplayStackTrace()).thenReturn(stackTraceEnabled); - EmbeddedRunner runner = mock(EmbeddedRunner.class); + EmbeddedScanner runner = mock(EmbeddedScanner.class); doThrow(e).when(runner).runAnalysis(any(Properties.class)); when(runnerFactory.create(any(Properties.class))).thenReturn(runner); @@ -140,7 +140,7 @@ public class MainTest { @Test public void should_not_stop_on_error_in_interactive_mode() throws Exception { - EmbeddedRunner runner = mock(EmbeddedRunner.class); + EmbeddedScanner runner = mock(EmbeddedScanner.class); doThrow(new IllegalStateException("Error")).when(runner).runAnalysis(any(Properties.class)); when(runnerFactory.create(any(Properties.class))).thenReturn(runner); when(cli.isInteractive()).thenReturn(true); diff --git a/src/test/java/org/sonarsource/scanner/cli/RunnerFactoryTest.java b/src/test/java/org/sonarsource/scanner/cli/ScannerFactoryTest.java index 5807952..2e60e81 100644 --- a/src/test/java/org/sonarsource/scanner/cli/RunnerFactoryTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/ScannerFactoryTest.java @@ -19,10 +19,11 @@ */ package org.sonarsource.scanner.cli; -import org.sonar.runner.api.LogOutput.Level; +import org.sonarsource.scanner.api.EmbeddedScanner; +import org.sonarsource.scanner.api.LogOutput; +import org.sonarsource.scanner.api.LogOutput.Level; import org.sonarsource.scanner.cli.Logs; -import org.sonarsource.scanner.cli.RunnerFactory; -import org.sonar.runner.api.LogOutput; +import org.sonarsource.scanner.cli.ScannerFactory; import org.junit.Before; import java.util.Properties; @@ -33,10 +34,10 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.mock; import org.junit.Test; -import org.sonar.runner.api.EmbeddedRunner; + import static org.fest.assertions.Assertions.assertThat; -public class RunnerFactoryTest { +public class ScannerFactoryTest { Properties props = new Properties(); Logs logs; @@ -49,15 +50,15 @@ public class RunnerFactoryTest { @Test public void should_create_embedded_runner() { props.setProperty("foo", "bar"); - EmbeddedRunner runner = new RunnerFactory(logs).create(props); + EmbeddedScanner runner = new ScannerFactory(logs).create(props); - assertThat(runner).isInstanceOf(EmbeddedRunner.class); + assertThat(runner).isInstanceOf(EmbeddedScanner.class); assertThat(runner.globalProperties().get("foo")).isEqualTo("bar"); } @Test public void should_fwd_logs() { - LogOutput logOutput = new RunnerFactory(logs).new DefaultLogOutput(); + LogOutput logOutput = new ScannerFactory(logs).new DefaultLogOutput(); String msg = "test"; |