blob: c540cf5ea7aa5756c3b0f573d5d87dd221b73a6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package vid.automation.test.utils;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
public class RegExMatcher extends TypeSafeMatcher<String> {
private final String regEx;
public RegExMatcher(String regEx) {
this.regEx = regEx;
}
@Override
public void describeTo(Description description) {
description.appendText("matches regEx="+regEx);
}
@Override
protected boolean matchesSafely(String item) {
return item.matches(regEx);
}
public static RegExMatcher matchesRegEx(final String regEx) {
return new RegExMatcher(regEx);
}
}
|