More tests.
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 @@
// 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 @@
* 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 @@
}
/**
+ * 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