Merge pull request #10867 from nirm2009/master

BAEL-4881 - Update IgnoringPatternMetacharactersUnitTest.java
This commit is contained in:
bfontana 2021-06-07 22:18:06 -03:00 committed by GitHub
commit 3cabed6990
1 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ public class IgnoringPatternMetacharactersUnitTest {
private static final String patternStr = "$100.50"; private static final String patternStr = "$100.50";
@Test @Test
public void givenPatternStringHasMetacharacters_whenPatternMatchedWithoutEscapingMetacharacters_thenNoMatchesFound() { public void whenMetacharactersNotEscaped_thenNoMatchesFound() {
Pattern pattern = Pattern.compile(patternStr); Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(dollarAmounts); Matcher matcher = pattern.matcher(dollarAmounts);
@ -25,7 +25,7 @@ public class IgnoringPatternMetacharactersUnitTest {
} }
@Test @Test
public void givenPatternStringHasMetacharacters_whenPatternCompiledUsingManuallyMetaEscapedPattern_thenMatchingSuccessful() { public void whenMetacharactersManuallyEscaped_thenMatchingSuccessful() {
String metaEscapedPatternStr = "\\Q" + patternStr + "\\E"; String metaEscapedPatternStr = "\\Q" + patternStr + "\\E";
Pattern pattern = Pattern.compile(metaEscapedPatternStr); Pattern pattern = Pattern.compile(metaEscapedPatternStr);
Matcher matcher = pattern.matcher(dollarAmounts); Matcher matcher = pattern.matcher(dollarAmounts);
@ -39,7 +39,7 @@ public class IgnoringPatternMetacharactersUnitTest {
} }
@Test @Test
public void givenPatternStringHasMetacharacters_whenPatternCompiledUsingLiteralPatternFromQuote_thenMatchingSuccessful() { public void whenMetacharactersEscapedUsingPatternQuote_thenMatchingSuccessful() {
String literalPatternStr = Pattern.quote(patternStr); String literalPatternStr = Pattern.quote(patternStr);
Pattern pattern = Pattern.compile(literalPatternStr); Pattern pattern = Pattern.compile(literalPatternStr);
Matcher matcher = pattern.matcher(dollarAmounts); Matcher matcher = pattern.matcher(dollarAmounts);