1 3 package org.jmock.expectation; 4 5 import java.util.ArrayList ; 6 import java.util.Collection ; 7 import junit.framework.Assert; 8 9 10 public class ExpectationList extends AbstractExpectationCollection 11 { 12 protected ArrayList myExpectedItems = new ArrayList (); 13 protected ArrayList myActualItems = new ArrayList (); 14 15 public ExpectationList( String name ) { 16 super(name); 17 } 18 19 protected void checkImmediateValues( Object actualItem ) { 20 int size = myActualItems.size(); 21 Assert.assertTrue(myName 22 + " had different sizes\nExpected Size:" 23 + myExpectedItems.size() 24 + "\nReceived size: " 25 + size 26 + " when adding:" 27 + actualItem, 28 myExpectedItems.size() >= size); 29 assertEquals(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 } 42 | Popular Tags |