You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/06/26 14:56:06 UTC
[commons-text] branch master updated: Allow for subclassing.
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 0605269 Allow for subclassing.
0605269 is described below
commit 06052694b8be682fb0ab64484afb0ae19c521259
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 26 10:55:59 2020 -0400
Allow for subclassing.
---
.../org/apache/commons/text/StringSubstitutorTest.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
index b3132a1..29d6ea8 100644
--- a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java
@@ -17,8 +17,8 @@
package org.apache.commons.text;
-import static org.assertj.core.api.Assertions.assertThatNullPointerException;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+import static org.assertj.core.api.Assertions.assertThatNullPointerException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -44,9 +44,9 @@ import org.junit.jupiter.api.Test;
*/
public class StringSubstitutorTest {
- private Map<String, String> values;
+ protected Map<String, String> values;
- private void doTestNoReplace(final String replaceTemplate) throws IOException {
+ protected void doTestNoReplace(final String replaceTemplate) throws IOException {
final StringSubstitutor sub = new StringSubstitutor(values);
if (replaceTemplate == null) {
@@ -71,13 +71,13 @@ public class StringSubstitutorTest {
}
}
- private void doTestReplace(final String expectedResult, final String replaceTemplate, final boolean substring)
+ protected void doTestReplace(final String expectedResult, final String replaceTemplate, final boolean substring)
throws IOException {
final StringSubstitutor sub = new StringSubstitutor(values);
doTestReplace(sub, expectedResult, replaceTemplate, substring);
}
- private void doTestReplace(final StringSubstitutor sub, final String expectedResult, final String replaceTemplate,
+ protected void doTestReplace(final StringSubstitutor sub, final String expectedResult, final String replaceTemplate,
final boolean substring) throws IOException {
final String expectedShortResult = expectedResult.substring(1, expectedResult.length() - 1);
@@ -541,6 +541,11 @@ public class StringSubstitutorTest {
}
@Test
+ public void testReplaceSimplest() throws IOException {
+ doTestReplace("quick brown fox", "${animal}", false);
+ }
+
+ @Test
public void testReplaceTakingCharSequenceReturningNull() {
final StringSubstitutor strSubstitutor = new StringSubstitutor((StringLookup) null);