init commit (#11496)
This commit is contained in:
parent
8809312a13
commit
7b564fe3ef
@ -11,6 +11,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
public class MatcherUnitTest {
|
||||
|
||||
private static final String STRING_INPUT = "test+";
|
||||
private static final String REGEX = "\\+";
|
||||
|
||||
@Test
|
||||
public void whenFindFourDigitWorks_thenCorrect() {
|
||||
Pattern stringPattern = Pattern.compile("\\d\\d\\d\\d");
|
||||
@ -60,4 +63,16 @@ public class MatcherUnitTest {
|
||||
assertTrue(m.matches());// matches will always return the same return
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenUsingMatcher_thenReturnTrue() {
|
||||
Pattern pattern = Pattern.compile(REGEX);
|
||||
Matcher matcher = pattern.matcher(STRING_INPUT);
|
||||
assertTrue(matcher.find());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenUsingMatches_thenReturnFalse() {
|
||||
assertFalse(Pattern.matches(REGEX, STRING_INPUT));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user