|
|||||||||||||||||||
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 | |||||||||||||||
ExpectationList.java | - | 100% | 100% | 100% |
|
1 |
/* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
|
|
2 |
package org.jmock.expectation;
|
|
3 |
|
|
4 |
import junit.framework.Assert;
|
|
5 |
|
|
6 |
import java.util.ArrayList;
|
|
7 |
import java.util.Collection;
|
|
8 |
|
|
9 |
public class ExpectationList extends AbstractExpectationCollection { |
|
10 |
protected ArrayList myExpectedItems = new ArrayList(); |
|
11 |
protected ArrayList myActualItems = new ArrayList(); |
|
12 |
|
|
13 | 34 |
public ExpectationList(String name) {
|
14 | 34 |
super(name);
|
15 |
} |
|
16 |
|
|
17 | 28 |
protected void checkImmediateValues(Object actualItem) { |
18 | 28 |
int size = myActualItems.size();
|
19 | 28 |
Assert.assertTrue( |
20 |
myName |
|
21 |
+ " had different sizes\nExpected Size:"
|
|
22 |
+ myExpectedItems.size() |
|
23 |
+ "\nReceived size: "
|
|
24 |
+ size |
|
25 |
+ " when adding:"
|
|
26 |
+ actualItem, |
|
27 |
myExpectedItems.size() >= size); |
|
28 | 24 |
assertEquals( |
29 |
myName + " added item does not match",
|
|
30 |
myExpectedItems.get(size - 1), |
|
31 |
actualItem); |
|
32 |
} |
|
33 |
|
|
34 | 130 |
protected Collection getActualCollection() {
|
35 | 130 |
return myActualItems;
|
36 |
} |
|
37 |
|
|
38 | 64 |
protected Collection getExpectedCollection() {
|
39 | 64 |
return myExpectedItems;
|
40 |
} |
|
41 |
} |
|
42 |
|
|