diff --git a/utils/src/main/java/com/indix/gocd/utils/GoEnvironment.java b/utils/src/main/java/com/indix/gocd/utils/GoEnvironment.java index 8999089..30c8c39 100644 --- a/utils/src/main/java/com/indix/gocd/utils/GoEnvironment.java +++ b/utils/src/main/java/com/indix/gocd/utils/GoEnvironment.java @@ -18,13 +18,14 @@ */ public class GoEnvironment { private Pattern envPat = Pattern.compile("\\$\\{(\\w+)\\}"); - private Map environment = new HashMap(); + private Map environment = new HashMap<>(); public GoEnvironment() { - this(System.getenv()); + this.environment.putAll(System.getenv()); } public GoEnvironment(Map defaultEnvironment) { + this(); this.environment.putAll(defaultEnvironment); } diff --git a/utils/src/test/java/com/indix/gocd/utils/GoEnvironmentTest.java b/utils/src/test/java/com/indix/gocd/utils/GoEnvironmentTest.java index 08bb762..3ce287d 100644 --- a/utils/src/test/java/com/indix/gocd/utils/GoEnvironmentTest.java +++ b/utils/src/test/java/com/indix/gocd/utils/GoEnvironmentTest.java @@ -71,8 +71,7 @@ public void shouldNotReplaceUnknownEnvVariables() { assertThat(replaced, is("COUNT:1 ${DOESNT_EXIST}")); } - - + @Test public void shouldGetHasAWSUseIamRoleTrueIfSetToTrue() { GoEnvironment sut = new GoEnvironment(mockEnvironmentVariables