diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2017-04-12 15:35:13 +0200 |
---|---|---|
committer | Julien HENRY <henryju@yahoo.fr> | 2017-04-12 20:57:37 +0200 |
commit | 3f8feb090594863155ce0cb1451128559965836d (patch) | |
tree | 31d51e65321bf813a6f205bb4490cceda0341879 /src | |
parent | ab646a451062935cc9d9b32fbe80e3c489262230 (diff) | |
download | sonar-scanner-cli-3f8feb090594863155ce0cb1451128559965836d.tar.gz sonar-scanner-cli-3f8feb090594863155ce0cb1451128559965836d.zip |
SQSCANNER-39 Don't filter properties with blank value
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/sonarsource/scanner/cli/PropertyResolver.java | 1 | ||||
-rw-r--r-- | src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java | 19 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/PropertyResolver.java b/src/main/java/org/sonarsource/scanner/cli/PropertyResolver.java index d1fe2c8..d92f7fe 100644 --- a/src/main/java/org/sonarsource/scanner/cli/PropertyResolver.java +++ b/src/main/java/org/sonarsource/scanner/cli/PropertyResolver.java @@ -67,6 +67,7 @@ public class PropertyResolver { private String resolveProperty(String propKey) { String propValue = getValue(propKey); if (propValue.isEmpty()) { + resolved.setProperty(propKey, propValue); return propValue; } diff --git a/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java b/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java index cece2a0..eecca98 100644 --- a/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java @@ -19,16 +19,15 @@ */ package org.sonarsource.scanner.cli; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.HashMap; import java.util.Map; import java.util.Properties; - import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import static org.assertj.core.api.Assertions.assertThat; + public class PropertyResolverTest { @Rule public ExpectedException exception = ExpectedException.none(); @@ -120,4 +119,18 @@ public class PropertyResolverTest { PropertyResolver resolver = new PropertyResolver(map, env); resolver.resolve(); } + + @Test + public void preserve_empty() { + Properties map = new Properties(); + Map<String, String> env = new HashMap<>(); + + map.put("A", ""); + map.put("B", "${A}"); + + PropertyResolver resolver = new PropertyResolver(map, env); + Properties resolved = resolver.resolve(); + assertThat(resolved.get("A")).isEqualTo(""); + assertThat(resolved.get("B")).isEqualTo(""); + } } |