Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case to expose bug with placeholder in default value for known value #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading