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. More...
Public Member Functions | |
ReturnObjectList (const String &name, VerifiableList *parent) | |
Construct a new empty list. | |
ReturnObjectList & | addObjectToReturn (const T &anObjectToReturn) |
Add a next object to the end of the list. | |
ReturnObjectList & | addObjectToReturn (const T &anObjectToReturn, unsigned count) |
Adds a series of equal next objects to the end of the list. | |
template<class I > | |
ReturnObjectList & | addObjectToReturn (I items, I end) |
Add a sequence of next objects to the end of the list. | |
void | setDefaultReturnValue (const T &defaultObj) |
Sets a default object which is returned when the list is empty. | |
T | nextReturnObject () |
Returns the next object from the list. | |
void | reset () |
Removes all the objects from the list. | |
String | toString () const |
Transform the object's state to a human readable string. | |
bool | hasMoreObjects () const |
Returns true if there are more objects to be returned. | |
virtual void | verify () |
Verify that there are no objects left within the list. |
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 every sucessive call to nextReturnObject the next object in the list will returned.
If the nextReturnObject method is called and there are no objects in the list an assertion error will be thrown. If the verify method is called and there are objects still in the list an assertion error will also be thrown.
Definition at line 62 of file ReturnObjectList.h.
mockpp::ReturnObjectList< T >::ReturnObjectList | ( | const String & | name, | |
VerifiableList * | parent | |||
) | [inline] |
Construct a new empty list.
name | Label used to identify list | |
parent | parent verifiable |
Definition at line 70 of file ReturnObjectList.h.
ReturnObjectList& mockpp::ReturnObjectList< T >::addObjectToReturn | ( | I | items, | |
I | end | |||
) | [inline] |
Add a sequence of next objects to the end of the list.
items | start iterator | |
end | terminating iterator (note: one element "behind" as always with STL) |
Definition at line 107 of file ReturnObjectList.h.
ReturnObjectList& mockpp::ReturnObjectList< T >::addObjectToReturn | ( | const T & | anObjectToReturn, | |
unsigned | count | |||
) | [inline] |
Adds a series of equal next objects to the end of the list.
anObjectToReturn | object to be added to the list | |
count | the count the object is added |
Definition at line 93 of file ReturnObjectList.h.
ReturnObjectList& mockpp::ReturnObjectList< T >::addObjectToReturn | ( | const T & | anObjectToReturn | ) | [inline] |
Add a next object to the end of the list.
anObjectToReturn | object to be added to the list |
Definition at line 81 of file ReturnObjectList.h.
bool mockpp::ReturnObjectList< T >::hasMoreObjects | ( | ) | const [inline] |
Returns true if there are more objects to be returned.
Definition at line 188 of file ReturnObjectList.h.
T mockpp::ReturnObjectList< T >::nextReturnObject | ( | ) | [inline] |
Returns the next object from the list.
Each object it returned in the order in which they where added.
Definition at line 129 of file ReturnObjectList.h.
void mockpp::ReturnObjectList< T >::setDefaultReturnValue | ( | const T & | defaultObj | ) | [inline] |
Sets a default object which is returned when the list is empty.
Using the default object does not affect the behaviour of verify().
defaultObj | default object to return |
Definition at line 119 of file ReturnObjectList.h.
String mockpp::ReturnObjectList< T >::toString | ( | ) | const [inline] |
Transform the object's state to a human readable string.
The string only contains the remaining objects.
Definition at line 158 of file ReturnObjectList.h.
virtual void mockpp::ReturnObjectList< T >::verify | ( | ) | [inline, virtual] |
Verify that there are no objects left within the list.
If it fails, an AssertionFailedError is thrown
Implements mockpp::Verifiable.
Definition at line 197 of file ReturnObjectList.h.