diff options
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"); + } + } |