|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Find | Line # 12 | 3 | 3 | 100% |
1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (2) | |||
| Result | |||
|
0.6666667
|
org.easymock.tests2.ConstraintsToStringTest.findToString
org.easymock.tests2.ConstraintsToStringTest.findToString
|
1 PASS | |
|
0.6666667
|
org.easymock.tests2.UsageConstraintsTest.testFind
org.easymock.tests2.UsageConstraintsTest.testFind
|
1 PASS | |
| 1 | /* | |
| 2 | * Copyright (c) 2001-2008 OFFIS, Tammo Freese. | |
| 3 | * This program is made available under the terms of the MIT License. | |
| 4 | */ | |
| 5 | package org.easymock.internal.matchers; | |
| 6 | ||
| 7 | import java.io.Serializable; | |
| 8 | import java.util.regex.Pattern; | |
| 9 | ||
| 10 | import org.easymock.IArgumentMatcher; | |
| 11 | ||
| 12 | public class Find implements IArgumentMatcher, Serializable { | |
| 13 | ||
| 14 | private static final long serialVersionUID = -7104607303959381785L; | |
| 15 | ||
| 16 | private final String regex; | |
| 17 | ||
| 18 | 3 |
public Find(String regex) { |
| 19 | 3 | this.regex = regex; |
| 20 | } | |
| 21 | ||
| 22 | 4 |
public boolean matches(Object actual) { |
| 23 | 4 | return (actual instanceof String) |
| 24 | && Pattern.compile(regex).matcher((String) actual).find(); | |
| 25 | } | |
| 26 | ||
| 27 | 1 |
public void appendTo(StringBuffer buffer) { |
| 28 | 1 | buffer.append("find(\"" + regex.replaceAll("\\\\", "\\\\\\\\") + "\")"); |
| 29 | } | |
| 30 | } | |
|
||||||||||