Skip to content

Commit 66b088e

Browse files
committed
Add couple of cases for RegExp test class
1 parent 2f99a38 commit 66b088e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/java/by/andd3dfx/regexp/RegExpCheckerTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
*/
1717
public class RegExpCheckerTest {
1818

19+
@Test
20+
public void ipAddressRegExp() {
21+
assertThat(extractStringByRegExp("((\\d{1,2}|1\\d{2}|2[0-5]{2})\\.){3}((\\d{1,2}|1\\d{2}|2[0-5]{2}))",
22+
"Bla, some ip-address 192.168.1.1 here."), is("192.168.1.1"));
23+
}
24+
1925
@Test
2026
public void repeatableExpressions() {
2127
assertThat("Color should be found",
@@ -56,6 +62,13 @@ public void lookForwardAndBackward() {
5662
is("30"));
5763
}
5864

65+
@Test
66+
public void reuseAlreadyDeclaredExpressionWithLinkAndLookForwardAndBackward() {
67+
assertThat("Inner content of tag <h1> should be found",
68+
extractStringByRegExp("(?<=<([hH][1-6])>).*(?=</\\1>)", "Bla, some <h1>test string</h1> here."),
69+
is("test string"));
70+
}
71+
5972
@Test
6073
public void compositeExpression() {
6174
assertThat("Phone in +ddd-dd-ddd-dd-dd format should be found",

0 commit comments

Comments
 (0)