source:
java2python/geniuswebtranslator/geniuswebtest/geniusweb/issuevalue/PatternMatch.java@
595
Last change on this file since 595 was 595, checked in by , 14 months ago | |
---|---|
File size: 726 bytes |
Rev | Line | |
---|---|---|
[595] | 1 | package geniusweb.issuevalue; |
2 | ||
3 | import org.hamcrest.Description; | |
4 | import org.hamcrest.Matcher; | |
5 | ||
6 | public class PatternMatch implements Matcher<String> { | |
7 | ||
8 | private String regex; | |
9 | ||
10 | public PatternMatch(String regex) { | |
11 | this.regex = regex; | |
12 | } | |
13 | ||
14 | @Override | |
15 | public void describeTo(Description description) { | |
16 | description.appendText("'" + regex + "'"); | |
17 | } | |
18 | ||
19 | @Override | |
20 | public boolean matches(Object item) { | |
21 | return ((String) item).matches(regex); | |
22 | } | |
23 | ||
24 | @Override | |
25 | public void describeMismatch(Object text, Description mismatchDescription) { | |
26 | mismatchDescription.appendText("'" + text + "' does not match regular expression '" + regex + "'"); | |
27 | } | |
28 | ||
29 | @Override | |
30 | public void _dont_implement_Matcher___instead_extend_BaseMatcher_() { | |
31 | } | |
32 | ||
33 | } |
Note:
See TracBrowser
for help on using the repository browser.