java.lang.Object
com.mockobjects.ReturnObjectBag
- All Implemented Interfaces:
- Verifiable
- public class ReturnObjectBag
- extends java.lang.Object
- implements Verifiable
The ReturnObjectBag is a map containing instances of ReturnObjectList.
A single instance is held for each mapkey. Every time a call to putObjectToReturn or
getNextReturnObject is made an object is added or removed from the ReturnObjectList for
the given key.
This allows the ReturnObjectBag to be used to return an ordered list of objects for each key
regardless of the order in which the key requests are made.
- Version:
- $Revision: 1.4 $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
returnObjectLists
private final java.util.Hashtable returnObjectLists
name
private final java.lang.String name
ReturnObjectBag
public ReturnObjectBag(java.lang.String name)
putObjectToReturn
public void putObjectToReturn(java.lang.Object key,
java.lang.Object value)
- Places an object into the list of return objects for a particular key
putObjectToReturn
public void putObjectToReturn(int key,
java.lang.Object value)
- Places an object into the list of return objects for a particular int key
putObjectToReturn
public void putObjectToReturn(java.lang.Object key,
int value)
- Places an int into the list of return objects for a particular key. The value can be retrieved
using the getNextReturnInt method
putObjectToReturn
public void putObjectToReturn(java.lang.Object key,
boolean value)
- Places an boolean into the list of return objects for a particular key. The value can be retrieved
using the getNextReturnBoolean method
verify
public void verify()
- Checks each the list for each key to verify that all no objects remain
in the list for that key.
- Specified by:
verify in interface Verifiable
getNextReturnObject
public java.lang.Object getNextReturnObject(java.lang.Object key)
- Returns the next object in the ReturnObjectList for a given key.
The call will throw an AssertFailError if the requested key is
not present within this ReturnObjectBag.
getNextReturnObject
public java.lang.Object getNextReturnObject(int key)
- Returns the next object in the ReturnObjectList for a given int key.
The call will throw an AssertFailError if the requested key is
not present within this ReturnObjectBag.
getHashTable
public java.util.Hashtable getHashTable()
getNextReturnInt
public int getNextReturnInt(java.lang.Object key)
getNextReturnBoolean
public boolean getNextReturnBoolean(java.lang.Object key)