Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects
In directory usw-pr-cvs1:/tmp/cvs-serv31235/src/core/com/mockobjects
Added Files:
ReturnObjectList.java
Log Message:
Added new object to handle lists of returned objects
--- NEW FILE: ReturnObjectList.java ---
package com.mockobjects;
import com.mockobjects.util.AssertMo;
import java.util.Vector;
public class ReturnObjectList implements Verifiable {
private final Vector myObjects = new Vector();
private final String myName;
public ReturnObjectList(String aName) {
this.myName = aName;
}
public void addObjectToReturn(Object anObjectToReturn){
myObjects.add(anObjectToReturn);
}
public Object nextReturnObject(){
if(myObjects.size()>0){
return myObjects.remove(0);
}else{
AssertMo.fail(myName + " has run out of objects.");
return null;
}
}
public void verify() {
AssertMo.assertEquals(myName + " has un-used objects.", 0, myObjects.size());
}
}
|