[BAEL-5518] Create Array of Regex Matches (#12052)
* opokharel's code for "A quick and practical example of Hexagonal Architecture in Java" * opokharel - added unit Tests * [BAEL-5518] by @opokharel * updated Files * updated formatting * whitespaceFix * [BAEL-5518] Create Array of Regex Matches * reCreatingPR
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package regex.array;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import regex.array.RegexMatches;
|
||||
|
||||
class RegexMatchesUnitTest {
|
||||
|
||||
@Test
|
||||
void whenFourNums_thenFourMatches() {
|
||||
RegexMatches rm = new RegexMatches();
|
||||
String actual[] = rm.regexMatch("7801111211fsdafasdfa 7802222222 sadfsadfsda7803333333 sadfdasfasd 7804444444");
|
||||
|
||||
assertArrayEquals(new String[] {"7801111211", "7802222222", "7803333333", "7804444444"}, actual, "success");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenThreeNums_thenThreeMatches() {
|
||||
RegexMatches rm = new RegexMatches();
|
||||
String actual[] = rm.regexMatch("7801111211fsdafasdfa 780222222 sadfsadfsda7803333333 sadfdasfasd 7804444444");
|
||||
|
||||
assertArrayEquals(new String[] {"7801111211", "7803333333", "7804444444"}, actual, "success");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenZeroNums_thenZeroMatches() {
|
||||
RegexMatches rm = new RegexMatches();
|
||||
String actual[] = rm.regexMatch("78011111fsdafasdfa 780222222 sadfsadfsda78033333 sadfdasfasd 7804444");
|
||||
|
||||
assertArrayEquals(new String[] {}, actual, "success");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user