|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| package org.easymock.internal.matchers; |
|
6 |
| |
|
7 |
| import java.util.Iterator; |
|
8 |
| import java.util.List; |
|
9 |
| |
|
10 |
| import org.easymock.IArgumentMatcher; |
|
11 |
| |
|
12 |
| public class And implements IArgumentMatcher { |
|
13 |
| |
|
14 |
| private final List<IArgumentMatcher> matchers; |
|
15 |
| |
|
16 |
12
| public And(List<IArgumentMatcher> matchers) {
|
|
17 |
12
| this.matchers = matchers;
|
|
18 |
| } |
|
19 |
| |
|
20 |
17
| public boolean matches(Object actual) {
|
|
21 |
17
| for (IArgumentMatcher matcher : matchers) {
|
|
22 |
34
| if (!matcher.matches(actual)) {
|
|
23 |
2
| return false;
|
|
24 |
| } |
|
25 |
| } |
|
26 |
15
| return true;
|
|
27 |
| } |
|
28 |
| |
|
29 |
4
| public void appendTo(StringBuffer buffer) {
|
|
30 |
4
| buffer.append("and(");
|
|
31 |
4
| for (Iterator<IArgumentMatcher> it = matchers.iterator(); it.hasNext();) {
|
|
32 |
8
| it.next().appendTo(buffer);
|
|
33 |
8
| if (it.hasNext()) {
|
|
34 |
4
| buffer.append(", ");
|
|
35 |
| } |
|
36 |
| } |
|
37 |
4
| buffer.append(")");
|
|
38 |
| } |
|
39 |
| } |