1 3 package org.jmock.expectation; 4 5 import java.util.Collection ; 6 import java.util.HashSet ; 7 8 9 public class ExpectationSet extends AbstractExpectationCollection 10 { 11 private HashSet myExpectedItems = new HashSet (); 12 private HashSet myActualItems = new HashSet (); 13 14 public ExpectationSet( String name ) { 15 super(name); 16 } 17 18 protected void checkImmediateValues( Object actualItem ) { 19 AssertMo.assertTrue(myName + " received an unexpected item\nUnexpected:" + actualItem, 20 new HashSet (myExpectedItems).contains(actualItem)); 21 } 22 23 protected Collection getActualCollection() { 24 return myActualItems; 25 } 26 27 protected Collection getExpectedCollection() { 28 return myExpectedItems; 29 } 30 31 public void verify() { 32 assertEquals("did not receive the expected collection items.", 33 new HashSet (getExpectedCollection()), 34 new HashSet (getActualCollection())); 35 } 36 37 } 38 | Popular Tags |