org.jmock.expectation
Class ReturnObjectBag
- Verifiable
public class ReturnObjectBag
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.
Hashtable | getHashTable()
|
boolean | getNextReturnBoolean(Object key)
|
int | getNextReturnInt(Object key)
|
Object | getNextReturnObject(Object key) - Returns the next object in the ReturnObjectList for a given key.
|
Object | getNextReturnObject(int key) - Returns the next object in the ReturnObjectList for a given int key.
|
void | putObjectToReturn(Object key, Object value) - Places an object into the list of return objects for a particular key
|
void | putObjectToReturn(Object key, boolean value) - Places an boolean into the list of return objects for a particular key.
|
void | putObjectToReturn(Object key, int value) - Places an int into the list of return objects for a particular key.
|
void | putObjectToReturn(int key, Object value) - Places an object into the list of return objects for a particular int key
|
void | verify() - Checks each the list for each key to verify that all no objects remain
in the list for that key.
|
ReturnObjectBag
public ReturnObjectBag(String name)
name
- Name used to describe an instance of ReturnObjectBag in error messages
getHashTable
public Hashtable getHashTable()
getNextReturnBoolean
public boolean getNextReturnBoolean(Object key)
getNextReturnInt
public int getNextReturnInt(Object key)
getNextReturnObject
public Object getNextReturnObject(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.
key
- The key for which the next object should be returned.
- The next object from the ReturnObjectList stored against the given key.
getNextReturnObject
public 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.
key
- The key for which the next object should be returned.
- The next object from the ReturnObjectList stored against the given key.
putObjectToReturn
public void putObjectToReturn(Object key,
Object value)
Places an object into the list of return objects for a particular key
key
- the key against which the object will be storedvalue
- the value to be added to the list for that key
ReturnObjectList.addObjectToReturn
putObjectToReturn
public void putObjectToReturn(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 invokedMethod
key
- the key against which the object will be storedvalue
- the value to be added to the list for that key
putObjectToReturn
public void putObjectToReturn(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 invokedMethod
key
- the key against which the object will be storedvalue
- the value to be added to the list for that key
putObjectToReturn
public void putObjectToReturn(int key,
Object value)
Places an object into the list of return objects for a particular int key
key
- the key against which the object will be storedvalue
- the value to be added to the list for that key
ReturnObjectList.addObjectToReturn
verify
public void verify()
Checks each the list for each key to verify that all no objects remain
in the list for that key.
- verify in interface Verifiable