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 96fdd3c  More tests.
96fdd3c is described below

commit 96fdd3cdb7f794dea4600c5e6fb893517a463c5e
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Jul 4 14:05:55 2020 -0400

    More tests.
---
 .../apache/commons/text/StringSubstitutorTest.java | 26 +++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java 
b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
index e9ee28e..1111d65 100644
--- a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
@@ -138,7 +138,7 @@ public class StringSubstitutorTest {
 
         // replace in StringBuffer
         buf = new StringBuffer(replaceTemplate);
-        assertTrue(sub.replaceIn(buf));
+        assertTrue(sub.replaceIn(buf), replaceTemplate);
         assertEquals(expectedResult, buf.toString());
         if (substring) {
             buf = new StringBuffer(replaceTemplate);
@@ -330,6 +330,14 @@ public class StringSubstitutorTest {
      * Tests when no variable name.
      */
     @Test
+    public void testReplaceEmptyKeyShortest() throws IOException {
+        doTestNoReplace(EMPTY_EXPR);
+    }
+
+    /**
+     * Tests when no variable name.
+     */
+    @Test
     public void testReplaceEmptyKeyWithDefault() throws IOException {
         doTestReplace("The animal jumps over the lazy dog.", "The ${:-animal} 
jumps over the ${target}.", true);
     }
@@ -343,6 +351,22 @@ public class StringSubstitutorTest {
     }
 
     /**
+     * Tests when no variable name.
+     */
+    @Test
+    public void testReplaceEmptyKeyWithDefaultOnlyEmpty() throws IOException {
+        doTestReplace("", "${:-}", false);
+    }
+
+    /**
+     * Tests when no variable name.
+     */
+    @Test
+    public void testReplaceEmptyKeyWithDefaultOnlyShortest() throws 
IOException {
+        doTestReplace("a", "${:-a}", false);
+    }
+
+    /**
      * Tests replace with null.
      */
     @Test

Reply via email to