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 public ExpectationList(String name) {
14 super(name);
15 }
16
17 protected void checkImmediateValues(Object actualItem) {
18 int size = myActualItems.size();
19 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 assertEquals(
29 myName + " added item does not match",
30 myExpectedItems.get(size - 1),
31 actualItem);
32 }
33
34 protected Collection getActualCollection() {
35 return myActualItems;
36 }
37
38 protected Collection getExpectedCollection() {
39 return myExpectedItems;
40 }
41 }
This page was automatically generated by Maven