|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| And | Line # 13 | 11 | 7 | 100% |
1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (5) | |||
| Result | |||
|
1.0
|
org.easymock.tests2.UsageConstraintsTest.constraints
org.easymock.tests2.UsageConstraintsTest.constraints
|
1 PASS | |
|
0.65
|
org.easymock.tests2.ConstraintsToStringTest.andToString
org.easymock.tests2.ConstraintsToStringTest.andToString
|
1 PASS | |
|
0.45
|
org.easymock.tests2.CaptureTest.testCaptureRightOne
org.easymock.tests2.CaptureTest.testCaptureRightOne
|
1 PASS | |
|
0.35
|
org.easymock.tests2.CaptureTest.testAnd
org.easymock.tests2.CaptureTest.testAnd
|
1 PASS | |
|
0.35
|
org.easymock.tests2.UsageConstraintsTest.andOverloaded
org.easymock.tests2.UsageConstraintsTest.andOverloaded
|
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.Iterator; | |
| 9 | import java.util.List; | |
| 10 | ||
| 11 | import org.easymock.IArgumentMatcher; | |
| 12 | ||
| 13 | public class And implements IArgumentMatcher, Serializable { | |
| 14 | ||
| 15 | private static final long serialVersionUID = 3874580646798403818L; | |
| 16 | ||
| 17 | private final List<IArgumentMatcher> matchers; | |
| 18 | ||
| 19 | 14 |
public And(List<IArgumentMatcher> matchers) { |
| 20 | 14 | this.matchers = matchers; |
| 21 | } | |
| 22 | ||
| 23 | 20 |
public boolean matches(Object actual) { |
| 24 | 20 | for (IArgumentMatcher matcher : matchers) { |
| 25 | 39 | if (!matcher.matches(actual)) { |
| 26 | 3 | return false; |
| 27 | } | |
| 28 | } | |
| 29 | 17 | return true; |
| 30 | } | |
| 31 | ||
| 32 | 4 |
public void appendTo(StringBuffer buffer) { |
| 33 | 4 | buffer.append("and("); |
| 34 | 12 | for (Iterator<IArgumentMatcher> it = matchers.iterator(); it.hasNext();) { |
| 35 | 8 | it.next().appendTo(buffer); |
| 36 | 8 | if (it.hasNext()) { |
| 37 | 4 | buffer.append(", "); |
| 38 | } | |
| 39 | } | |
| 40 | 4 | buffer.append(")"); |
| 41 | } | |
| 42 | } | |
|
||||||||||