org.jmock.expectation
Class ReturnObjectList

java.lang.Object
  extended by org.jmock.expectation.ReturnObjectList
All Implemented Interfaces:
Verifiable

public class ReturnObjectList
extends Object
implements Verifiable

This class allows a list of objects to be setup which can be used whilst.The list is check to make sure that all the object in it are used and that none are left over at the end of a test.

For ever sucessive call to nextReturnObject the next object in the list will returned.

If the nextReturnObject invokedMethod is called and there are no objects in the list an assertion error will be thrown. If the verify invokedMethod is called and there are objects still in the list an assertion error will also be thrown.


Constructor Summary
ReturnObjectList(String aName)
          Construct a new empty list
 
Method Summary
 void addObjectToReturn(boolean aBooleanToReturn)
          Add a next boolean to the end of the list.
 void addObjectToReturn(int anIntegerToReturn)
          Add a next integer to the end of the list.
 void addObjectToReturn(Object anObjectToReturn)
          Add a next object to the end of the list.
 Object nextReturnObject()
          Returns the next object from the list.
 void verify()
          Verify that there are no objects left within the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReturnObjectList

public ReturnObjectList(String aName)
Construct a new empty list

Parameters:
aName - Label used to identify list
Method Detail

addObjectToReturn

public void addObjectToReturn(Object anObjectToReturn)
Add a next object to the end of the list.

Parameters:
anObjectToReturn - object to be added to the list

addObjectToReturn

public void addObjectToReturn(boolean aBooleanToReturn)
Add a next boolean to the end of the list.

Parameters:
aBooleanToReturn - boolean to be added to the list

addObjectToReturn

public void addObjectToReturn(int anIntegerToReturn)
Add a next integer to the end of the list.

Parameters:
anIntegerToReturn - integer to be added to the list

nextReturnObject

public Object nextReturnObject()
Returns the next object from the list. Each object it returned in the order in which they where added.


verify

public void verify()
Verify that there are no objects left within the list.

Specified by:
verify in interface Verifiable