|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Matches | Line # 11 | 3 | 3 | 100% |
1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (2) | |||
| Result | |||
|
0.6666667
|
org.easymock.tests2.UsageConstraintsTest.testMatches
org.easymock.tests2.UsageConstraintsTest.testMatches
|
1 PASS | |
|
0.6666667
|
org.easymock.tests2.ConstraintsToStringTest.matchesToString
org.easymock.tests2.ConstraintsToStringTest.matchesToString
|
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 | ||
| 9 | import org.easymock.IArgumentMatcher; | |
| 10 | ||
| 11 | public class Matches implements IArgumentMatcher, Serializable { | |
| 12 | ||
| 13 | private static final long serialVersionUID = -6657694947057597484L; | |
| 14 | ||
| 15 | private final String regex; | |
| 16 | ||
| 17 | 3 |
public Matches(String regex) { |
| 18 | 3 | this.regex = regex; |
| 19 | } | |
| 20 | ||
| 21 | 4 |
public boolean matches(Object actual) { |
| 22 | 4 | return (actual instanceof String) && ((String) actual).matches(regex); |
| 23 | } | |
| 24 | ||
| 25 | 1 |
public void appendTo(StringBuffer buffer) { |
| 26 | 1 | buffer.append("matches(\"" + regex.replaceAll("\\\\", "\\\\\\\\") |
| 27 | + "\")"); | |
| 28 | } | |
| 29 | } | |
|
||||||||||