|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| package org.easymock.internal.matchers; |
|
6 |
| |
|
7 |
| import java.util.regex.Pattern; |
|
8 |
| |
|
9 |
| import org.easymock.IArgumentMatcher; |
|
10 |
| |
|
11 |
| public class Find implements IArgumentMatcher { |
|
12 |
| |
|
13 |
| private final String regex; |
|
14 |
| |
|
15 |
3
| public Find(String regex) {
|
|
16 |
3
| this.regex = regex;
|
|
17 |
| } |
|
18 |
| |
|
19 |
4
| public boolean matches(Object actual) {
|
|
20 |
4
| return (actual instanceof String)
|
|
21 |
| && Pattern.compile(regex).matcher((String) actual).find(); |
|
22 |
| } |
|
23 |
| |
|
24 |
1
| public void appendTo(StringBuffer buffer) {
|
|
25 |
1
| buffer.append("find(\"" + regex.replaceAll("\\\\", "\\\\\\\\") + "\")");
|
|
26 |
| } |
|
27 |
| } |