Improve How to Count the Number of Matches for a Regex? (#9788)
This commit is contained in:
parent
8527d58063
commit
353f454fe0
@ -1,12 +1,11 @@
|
|||||||
package com.baeldung.regex.countmatches;
|
package com.baeldung.regex.countmatches;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import org.junit.Test;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit Test intended to count number of matches of a RegEx using Java 8 and 9.
|
* Unit Test intended to count number of matches of a RegEx using Java 8 and 9.
|
||||||
@ -65,7 +64,7 @@ public class CountMatchesUnitTest {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
assertNotEquals(3, count);
|
assertEquals(2, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user