blob: c88c8a835a916746f0bae71dc97bf87e553576b2 (
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 org.onap.vid.testUtils;
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);
}
}
|