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 public ExpectationSet(String name) {
12 super(name);
13 }
14
15 protected void checkImmediateValues(Object actualItem) {
16 AssertMo.assertTrue(
17 myName + " did not receive an expected item\nUnexpected:" + actualItem,
18 new HashSet(myExpectedItems).contains(actualItem));
19 }
20
21 protected Collection getActualCollection() {
22 return myActualItems;
23 }
24
25 protected Collection getExpectedCollection() {
26 return myExpectedItems;
27 }
28
29 public void verify() {
30 assertEquals(
31 "did not receive the expected collection items.",
32 new HashSet(getExpectedCollection()),
33 new HashSet(getActualCollection()));
34 }
35
36 }
This page was automatically generated by Maven