1 package com.mockobjects; 2 3 import com.mockobjects.util.AssertMo; 4 5 import java.util.Vector ; 6 7 19 public class ReturnObjectList implements Verifiable { 20 21 private final Vector myObjects = new Vector (); 22 private final String myName; 23 24 28 public ReturnObjectList(String aName) { 29 this.myName = aName; 30 } 31 32 36 public void addObjectToReturn(Object anObjectToReturn){ 37 myObjects.add(anObjectToReturn); 38 } 39 40 44 public void addObjectToReturn(boolean aBooleanToReturn){ 45 myObjects.add(new Boolean (aBooleanToReturn)); 46 } 47 48 52 public void addObjectToReturn(int anIntegerToReturn){ 53 myObjects.add(new Integer (anIntegerToReturn)); 54 } 55 56 60 public Object nextReturnObject(){ 61 AssertMo.assertTrue(myName + " has run out of objects.", 62 myObjects.size() > 0); 63 return myObjects.remove(0); 64 } 65 66 69 public void verify() { 70 AssertMo.assertEquals(myName + " has un-used objects.", 0, 71 myObjects.size()); 72 } 73 } 74 | Popular Tags |