From: Duarte Meneses Date: Tue, 23 Aug 2016 12:44:56 +0000 (+0200) Subject: Improve test coverage X-Git-Tag: 2.7~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1a6e5d814b671a123916226d1025a328f4e9da25;p=sonar-scanner-cli.git Improve test coverage --- diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java index 19b953c..9833c85 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Main.java +++ b/src/main/java/org/sonarsource/scanner/cli/Main.java @@ -36,7 +36,7 @@ import org.sonarsource.scanner.api.EmbeddedScanner; * @since 1.0 */ public class Main { - + private static final String SEPARATOR = "------------------------------------------------------------------------"; private final Exit exit; private final Cli cli; private final Conf conf; @@ -112,11 +112,11 @@ public class Main { } private void displayExecutionResult(Stats stats, String resultMsg) { - logger.info("------------------------------------------------------------------------"); + logger.info(SEPARATOR); logger.info("EXECUTION " + resultMsg); - logger.info("------------------------------------------------------------------------"); + logger.info(SEPARATOR); stats.stop(); - logger.info("------------------------------------------------------------------------"); + logger.info(SEPARATOR); } private void showError(String message, Throwable e, boolean showStackTrace) { diff --git a/src/test/java/org/sonarsource/scanner/cli/ConfTest.java b/src/test/java/org/sonarsource/scanner/cli/ConfTest.java index 66e61e8..4b11a07 100644 --- a/src/test/java/org/sonarsource/scanner/cli/ConfTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/ConfTest.java @@ -231,6 +231,26 @@ public class ConfTest { assertThat(properties.getProperty("sonar.projectBaseDir")).isEqualTo(projectHome.toString()); } + @Test + public void failModuleBaseDirDoesNotExist() throws IOException { + args.setProperty("sonar.modules", "module1"); + args.setProperty("module1.sonar.projectBaseDir", "invalid"); + + exception.expect(IllegalStateException.class); + exception.expectMessage("The base directory of the module 'module1' does not exist"); + conf.properties(); + } + + @Test + public void failModulePropertyFileDoesNotExist() throws IOException { + args.setProperty("sonar.modules", "module1"); + args.setProperty("module1.sonar.projectConfigFile", "invalid"); + + exception.expect(IllegalStateException.class); + exception.expectMessage("The properties file of the module 'module1' does not exist"); + conf.properties(); + } + @Test public void shouldSupportSettingBaseDirFromCli() throws Exception { Path projectHome = Paths.get(getClass().getResource("ConfTest/shouldLoadModuleConfiguration/project").toURI());