Skip to content

Commit

Permalink
Add test case to expose bug with placeholder in default value for kno…
Browse files Browse the repository at this point in the history
…wn value
  • Loading branch information
KyRobbins committed Dec 28, 2023
1 parent aa234ae commit b690653
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ public void testDefaultValueForUnresolvedPropertyWithEnabledFlag() {
properties.setProperty("p11", "${malformed:with extra :");
properties.setProperty("p12", "${unknown::}");
properties.setProperty("p13", "${unknown: }");
properties.setProperty("p14", "${knownValue:${fallback}}");

properties.setProperty("host", "example.com");
properties.setProperty("port", "9090");
properties.setProperty("knownValue", "known value");
properties.setProperty("fallback", "fallback value");

String value1 = resolver.getPropertyValue("p1", properties, new Properties(), true);
Expand All @@ -256,6 +258,7 @@ public void testDefaultValueForUnresolvedPropertyWithEnabledFlag() {
String value11 = resolver.getPropertyValue("p11", properties, new Properties(), true);
String value12 = resolver.getPropertyValue("p12", properties, new Properties(), true);
String value13 = resolver.getPropertyValue("p13", properties, new Properties(), true);
String value14 = resolver.getPropertyValue("p14", properties, new Properties(), true);

assertEquals("${unknown}", value1);
assertEquals("defaultValue", value2);
Expand All @@ -270,6 +273,7 @@ public void testDefaultValueForUnresolvedPropertyWithEnabledFlag() {
assertEquals("${malformed:with extra :", value11);
assertEquals(":", value12);
assertEquals(" ", value13);
assertEquals("known value", value14);
}

/**
Expand Down

0 comments on commit b690653

Please sign in to comment.