Skip to content

Commit

Permalink
Merge pull request networknt#355 from networknt/issue_354
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu authored Jan 13, 2019
2 parents ee46489 + 6253272 commit 828e8a3
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions config/src/test/java/com/networknt/config/ConfigDefaultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

/**
Expand All @@ -35,6 +36,8 @@
public class ConfigDefaultTest extends TestCase {
Config config = null;
Map<String, Object> testMap = null;
String OS = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);


@Override
public void setUp() throws Exception {
Expand Down Expand Up @@ -62,7 +65,9 @@ public void testGetJsonMapConfig() throws Exception {
// case1: regular config
Assert.assertEquals("default config", configMap.get("value"));
// case2: config with environment variable
Assert.assertEquals(System.getenv("HOME"), configMap.get("value1"));
if (!OS.startsWith("windows")) {
Assert.assertEquals(System.getenv("HOME"), configMap.get("value1"));
}
// case3: escape from injecting environment variable
Assert.assertEquals("${ESCAPE}", configMap.get("value2"));
// case4: override to map with centralized file
Expand All @@ -79,7 +84,9 @@ public void testGetJsonObjectConfig() throws Exception {
// case1: regular config
Assert.assertEquals("default config", tc.getValue());
// case2: config with environment variable
Assert.assertEquals(System.getenv("HOME"), tc.getValue1());
if (!OS.startsWith("windows")) {
Assert.assertEquals(System.getenv("HOME"), tc.getValue1());
}
// case3: escape from injecting environment variable
Assert.assertEquals("${ESCAPE}", tc.getValue2());
// case4: override to map with centralized file
Expand All @@ -96,7 +103,9 @@ public void test1GetJsonMapConfig() throws Exception {
// case1: regular config
Assert.assertEquals("default config", configMap.get("value"));
// case2: config with environment variable
Assert.assertEquals(System.getenv("HOME"), configMap.get("value1"));
if (!OS.startsWith("windows")) {
Assert.assertEquals(System.getenv("HOME"), configMap.get("value1"));
}
// case3: escape from injecting environment variable
Assert.assertEquals("${ESCAPE}", configMap.get("value2"));
// case4: override to map with centralized file
Expand All @@ -113,7 +122,9 @@ public void test1GetJsonObjectConfig() throws Exception {
// case1: regular config
Assert.assertEquals("default config", tc.getValue());
// case2: config with environment variable
Assert.assertEquals(System.getenv("HOME"), tc.getValue1());
if (!OS.startsWith("windows")) {
Assert.assertEquals(System.getenv("HOME"), tc.getValue1());
}
// case3: escape from injecting environment variable
Assert.assertEquals("${ESCAPE}", tc.getValue2());
// case4: override to map with centralized file
Expand All @@ -130,7 +141,9 @@ public void test2GetJsonMapConfig() throws Exception {
// case1: regular config
Assert.assertEquals("default config", configMap.get("value"));
// case2: config with environment variable
Assert.assertEquals(System.getenv("HOME"), configMap.get("value1"));
if (!OS.startsWith("windows")) {
Assert.assertEquals(System.getenv("HOME"), configMap.get("value1"));
}
// case3: escape from injecting environment variable
Assert.assertEquals("${ESCAPE}", configMap.get("value2"));
// case4: override to map with centralized file
Expand All @@ -147,7 +160,9 @@ public void test2GetJsonObjectConfig() throws Exception {
// case1: regular config
Assert.assertEquals("default config", tc.getValue());
// case2: config with environment variable
Assert.assertEquals(System.getenv("HOME"), tc.getValue1());
if (!OS.startsWith("windows")) {
Assert.assertEquals(System.getenv("HOME"), tc.getValue1());
}
// case3: escape from injecting environment variable
Assert.assertEquals("${ESCAPE}", tc.getValue2());
// case4: override to map with centralized file
Expand Down

0 comments on commit 828e8a3

Please sign in to comment.