1 3 package org.jmock.expectation; 4 5 import java.util.Vector ; 6 import org.jmock.core.Verifiable; 7 8 9 21 public class ReturnObjectList implements Verifiable 22 { 23 24 private final Vector myObjects = new Vector (); 25 private final String myName; 26 27 32 public ReturnObjectList( String aName ) { 33 this.myName = aName; 34 } 35 36 41 public void addObjectToReturn( Object anObjectToReturn ) { 42 myObjects.add(anObjectToReturn); 43 } 44 45 50 public void addObjectToReturn( boolean aBooleanToReturn ) { 51 myObjects.add(new Boolean (aBooleanToReturn)); 52 } 53 54 59 public void addObjectToReturn( int anIntegerToReturn ) { 60 myObjects.add(new Integer (anIntegerToReturn)); 61 } 62 63 67 public Object nextReturnObject() { 68 AssertMo.assertTrue(myName + " has run out of objects.", 69 myObjects.size() > 0); 70 return myObjects.remove(0); 71 } 72 73 76 public void verify() { 77 AssertMo.assertEquals(myName + " has un-used objects.", 0, 78 myObjects.size()); 79 } 80 } 81 | Popular Tags |