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 741b9b0  Add testStaticReplaceSystemPropertiesWithUpdate.
741b9b0 is described below

commit 741b9b0e5bde6a66b45cd4bb1450ebf91322285d
Author: Gary Gregory <gardgreg...@gmail.com>
AuthorDate: Fri Jul 23 10:04:04 2021 -0400

    Add testStaticReplaceSystemPropertiesWithUpdate.
---
 .../org/apache/commons/text/StringSubstitutorTest.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java 
b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
index f16c5e4..1c06b0d 100644
--- a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
@@ -1042,6 +1042,21 @@ public class StringSubstitutorTest {
     }
 
     /**
+     * Tests interpolation with system properties.
+     */
+    @Test
+    public void testStaticReplaceSystemPropertiesWithUpdate() {
+        System.setProperty("foo", "bar1");
+        try {
+            assertEqualsCharSeq("bar1", 
StringSubstitutor.replaceSystemProperties("${foo}"));
+            System.setProperty("foo", "bar2");
+            assertEqualsCharSeq("bar2", 
StringSubstitutor.replaceSystemProperties("${foo}"));
+        } finally {
+            System.getProperties().remove("foo");
+        }
+    }
+
+    /**
      * Test the replace of a properties object
      */
     @Test

Reply via email to