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 0603c3a More tests. 0603c3a is described below commit 0603c3abc1edbb64f6d346fec7b11e0e58333afd Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jul 11 18:36:17 2020 -0400 More tests. --- .../apache/commons/text/StringSubstitutorTest.java | 55 +++++++++++----------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java index 4eaa12e..3465fea 100644 --- a/src/test/java/org/apache/commons/text/StringSubstitutorTest.java +++ b/src/test/java/org/apache/commons/text/StringSubstitutorTest.java @@ -66,6 +66,11 @@ public class StringSubstitutorTest { doTestNoReplace(new StringSubstitutor(values), replaceTemplate); } + protected void doReplace(final String expectedResult, final String replaceTemplate, final boolean substring) + throws IOException { + doTestReplace(new StringSubstitutor(values), expectedResult, replaceTemplate, substring); + } + protected void doTestNoReplace(final StringSubstitutor substitutor, final String replaceTemplate) throws IOException { if (replaceTemplate == null) { @@ -90,11 +95,6 @@ public class StringSubstitutorTest { } } - protected void doReplace(final String expectedResult, final String replaceTemplate, final boolean substring) - throws IOException { - doTestReplace(new StringSubstitutor(values), expectedResult, replaceTemplate, substring); - } - protected void doTestReplace(final StringSubstitutor sub, final String expectedResult, final String replaceTemplate, final boolean substring) throws IOException { final String expectedShortResult = substring ? expectedResult.substring(1, expectedResult.length() - 1) @@ -264,6 +264,28 @@ public class StringSubstitutorTest { } /** + * Tests interpolation with weird boundary patterns. + */ + @Test + @Disabled + public void testReplace_JiraText178_WeirdPattens() throws IOException { + doNotReplace("$${"); + doNotReplace("$${a"); + doNotReplace("$$${"); + doNotReplace("$$${a"); + doNotReplace("$${${a"); + } + + /** + * Tests interpolation with weird boundary patterns. + */ + @Test + @Disabled + public void testReplace_JiraText178_WeirdPattens_Partial() throws IOException { + doReplace("$${1", "$${${a}", false); + } + + /** * Tests adjacent keys. */ @Test @@ -932,31 +954,10 @@ public class StringSubstitutorTest { doNotReplace("${$$${a}}"); doNotReplace("${$$${a}}"); doNotReplace("${${${a}"); - } - - /** - * Tests interpolation with weird boundary patterns. - */ - @Test - @Disabled - public void testReplaceWeirdPattensNo_JiraText178() throws IOException { - doNotReplace("$${"); - doNotReplace("$${a"); - doNotReplace("$$${"); - doNotReplace("$$${a"); - doNotReplace("$${${a"); - } - - /** - * Tests interpolation with weird boundary patterns. - */ - @Test - @Disabled - public void testReplaceWeirdPattens_Partial_JiraText178() throws IOException { + // doReplace("${1}", "$${${a}}", false); doReplace("${12}", "$${${a}${b}}", false); doReplace("${${${a}2", "${${${a}${b}", false); - doReplace("$${1", "$${${a}", false); } /**