diff options
author | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2012-09-10 19:04:52 +0200 |
---|---|---|
committer | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2012-09-11 09:18:23 +0200 |
commit | fcd0b85e1c08caf84e6e07b992ccec1a76823320 (patch) | |
tree | 17215ebf404372f1133d62c608bfc8eeedaf771b /src/test/java/org | |
parent | 7ba663bea3a7a7e55b946de6de96237781bef01f (diff) | |
download | sonar-scanner-cli-fcd0b85e1c08caf84e6e07b992ccec1a76823320.tar.gz sonar-scanner-cli-fcd0b85e1c08caf84e6e07b992ccec1a76823320.zip |
SONARPLUGINS-2202 sonar.projectKey not mandatory on a module def.
=> it is automatically generated from the module Id found in
"sonar.modules"
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java b/src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java index b0d3d8f..2e7d596 100644 --- a/src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java +++ b/src/test/java/org/sonar/runner/internal/batch/SonarProjectBuilderTest.java @@ -363,4 +363,18 @@ public class SonarProjectBuilderTest { SonarProjectBuilder.checkUnicityOfChildKey(mod2, root); } + @Test + public void shouldSetProjectKeyIfNotPresent() { + Properties props = new Properties(); + props.put("sonar.projectVersion", "1.0"); + + // should be set + SonarProjectBuilder.setProjectKeyIfNotDefined(props, "foo"); + assertThat(props.getProperty("sonar.projectKey")).isEqualTo("foo"); + + // but not this 2nd time + SonarProjectBuilder.setProjectKeyIfNotDefined(props, "bar"); + assertThat(props.getProperty("sonar.projectKey")).isEqualTo("foo"); + } + } |