1 package com.mockobjects; 2 3 import com.mockobjects.util.AssertMo; 4 5 import java.util.Collection ; 6 import java.util.HashSet ; 7 8 public class ExpectationSet extends AbstractExpectationCollection { 9 private HashSet myExpectedItems = new HashSet(); 10 private HashSet myActualItems = new HashSet(); 11 12 public ExpectationSet(String name) { 13 super(name); 14 } 15 16 protected void checkImmediateValues(Object 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 getActualCollection() { 23 return myActualItems; 24 } 25 26 protected Collection getExpectedCollection() { 27 return myExpectedItems; 28 } 29 } 30 | Popular Tags |