|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ExpectationSet.java | - | 100% | 100% | 100% |
|
1 |
/* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
|
|
2 |
package org.jmock.expectation;
|
|
3 |
|
|
4 |
import java.util.Collection;
|
|
5 |
import java.util.HashSet;
|
|
6 |
|
|
7 |
public class ExpectationSet extends AbstractExpectationCollection { |
|
8 |
private HashSet myExpectedItems = new HashSet(); |
|
9 |
private HashSet myActualItems = new HashSet(); |
|
10 |
|
|
11 | 58 |
public ExpectationSet(String name) {
|
12 | 58 |
super(name);
|
13 |
} |
|
14 |
|
|
15 | 66 |
protected void checkImmediateValues(Object actualItem) { |
16 | 66 |
AssertMo.assertTrue( |
17 |
myName + " did not receive an expected item\nUnexpected:" + actualItem,
|
|
18 |
new HashSet(myExpectedItems).contains(actualItem));
|
|
19 |
} |
|
20 |
|
|
21 | 230 |
protected Collection getActualCollection() {
|
22 | 230 |
return myActualItems;
|
23 |
} |
|
24 |
|
|
25 | 120 |
protected Collection getExpectedCollection() {
|
26 | 120 |
return myExpectedItems;
|
27 |
} |
|
28 |
|
|
29 | 42 |
public void verify() { |
30 | 42 |
assertEquals( |
31 |
"did not receive the expected collection items.",
|
|
32 |
new HashSet(getExpectedCollection()),
|
|
33 |
new HashSet(getActualCollection()));
|
|
34 |
} |
|
35 |
|
|
36 |
} |
|
37 |
|
|