This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/master by this push:
new 401ff2c Add testSystemPropertyDefaultStringLookup.
401ff2c is described below
commit 401ff2cd1646cad947f938aea5e4abb03be1e342
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jul 23 10:28:13 2021 -0400
Add testSystemPropertyDefaultStringLookup.
---
.../text/StringSubstitutorWithInterpolatorStringLookupTest.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git
a/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
b/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
index 996a8de..9663499 100644
---
a/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
+++
b/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
@@ -227,4 +227,13 @@ public class
StringSubstitutorWithInterpolatorStringLookupTest {
Assertions.assertEquals(System.getProperty(spKey),
strSubst.replace("${sys:" + spKey + "}"));
}
+ @Test
+ public void testSystemPropertyDefaultStringLookup() {
+ final StringSubstitutor strSubst = new StringSubstitutor(
+
StringLookupFactory.INSTANCE.interpolatorStringLookup(StringLookupFactory.INSTANCE.systemPropertyStringLookup()));
+ final String spKey = "user.name";
+ Assertions.assertEquals(System.getProperty(spKey),
strSubst.replace("${" + spKey + "}"));
+ Assertions.assertEquals(System.getProperty(spKey),
strSubst.replace("${sys:" + spKey + "}"));
+ }
+
}