KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > ExpectationSet


1 package com.mockobjects;
2
3 import com.mockobjects.util.AssertMo;
4
5 import java.util.Collection JavaDoc;
6 import java.util.HashSet JavaDoc;
7
8 public class ExpectationSet extends AbstractExpectationCollection {
9     private HashSet myExpectedItems = new HashSet();
10     private HashSet myActualItems = new HashSet();
11
12     public ExpectationSet(String JavaDoc name) {
13         super(name);
14     }
15
16     protected void checkImmediateValues(Object JavaDoc actualItem) {
17         AssertMo.assertTrue(
18             myName + " did not receive an expected item\nUnexpected:" + actualItem,
19             new HashSet(myExpectedItems).contains(actualItem));
20     }
21
22     protected Collection JavaDoc getActualCollection() {
23         return myActualItems;
24     }
25
26     protected Collection JavaDoc getExpectedCollection() {
27         return myExpectedItems;
28     }
29 }
30
Popular Tags