A class to verify lists of expectations, one after the other as they occur. More...
Public Member Functions | |
ExpectationList (const String &name, VerifiableList *parent=0) | |
Constructs the expectation. | |
virtual void | verify () |
Verify that the expected values equal the expected ones. | |
void | addActual (const T &actualItem) |
Adds another actual value to the list. | |
template<class I > | |
void | addActual (I items, I end) |
Adds a sequence of actual values to the list. | |
ExpectationList & | addExpected (const T &expectedItem) |
Adds another expectation value to the list. | |
void | balanceActual () |
Copy one item from expectation list to actuals at same position. | |
template<class I > | |
ExpectationList & | addExpected (I items, I end) |
Adds a sequence of expectation values to the list. | |
virtual void | clearActual () |
Resets the internal state to reflect that there is no actual value set. | |
virtual void | reset () |
Resets the internal state completely. | |
unsigned | size () const |
Returns the amount of expectation values. | |
virtual void | setExpectNothing () |
Tell the object to expect nothing to happen to it, perhaps because the test is exercising the handling of an error. | |
Protected Member Functions | |
virtual void | clearExpectation () |
Clears the expectation list. | |
void | checkImmediateValue (const T &actualItem) const |
Checks if the actual value matches the expectation. |
A class to verify lists of expectations, one after the other as they occur.
Definition at line 49 of file ExpectationList.h.
mockpp::ExpectationList< T >::ExpectationList | ( | const String & | name, | |
VerifiableList * | parent = 0 | |||
) | [inline] |
Constructs the expectation.
name | human readable description about the expectation | |
parent | parent verifiable |
Definition at line 57 of file ExpectationList.h.
void mockpp::ExpectationList< T >::addActual | ( | I | items, | |
I | end | |||
) | [inline] |
Adds a sequence of actual values to the list.
items | start iterator | |
end | terminating iterator (note: one element "behind" as always with STL) |
Definition at line 115 of file ExpectationList.h.
void mockpp::ExpectationList< T >::addActual | ( | const T & | actualItem | ) | [inline] |
Adds another actual value to the list.
actualItem | new value |
Definition at line 100 of file ExpectationList.h.
ExpectationList& mockpp::ExpectationList< T >::addExpected | ( | I | items, | |
I | end | |||
) | [inline] |
Adds a sequence of expectation values to the list.
items | start iterator | |
end | terminating iterator (note: one element "behind" as always with STL) |
Definition at line 154 of file ExpectationList.h.
ExpectationList& mockpp::ExpectationList< T >::addExpected | ( | const T & | expectedItem | ) | [inline] |
Adds another expectation value to the list.
expectedItem | new value |
Definition at line 126 of file ExpectationList.h.
void mockpp::ExpectationList< T >::balanceActual | ( | ) | [inline] |
Copy one item from expectation list to actuals at same position.
Useful after recovering from an error at another place.
Definition at line 138 of file ExpectationList.h.
void mockpp::ExpectationList< T >::checkImmediateValue | ( | const T & | actualItem | ) | const [inline, protected, virtual] |
Checks if the actual value matches the expectation.
Note: in a list there can be any number of elements of a given value and the order of the elements must match exactly. If it fails, an AssertionFailedError is thrown
Implements mockpp::AbstractExpectationCollection< T >.
Definition at line 227 of file ExpectationList.h.
virtual void mockpp::ExpectationList< T >::setExpectNothing | ( | ) | [inline, virtual] |
Tell the object to expect nothing to happen to it, perhaps because the test is exercising the handling of an error.
The Expectation will fail if any actual values are set.
Note that this is not the same as not setting any expectations, in which case verify() will do nothing.
Implements mockpp::Expectation.
Definition at line 201 of file ExpectationList.h.
unsigned mockpp::ExpectationList< T >::size | ( | ) | const [inline] |
Returns the amount of expectation values.
Definition at line 188 of file ExpectationList.h.
virtual void mockpp::ExpectationList< T >::verify | ( | ) | [inline, virtual] |
Verify that the expected values equal the expected ones.
Note: in a list there can be any number of elements of a given value and the order of the elements must match exactly. If it fails, an AssertionFailedError is thrown
Implements mockpp::AbstractExpectation< T >.
Definition at line 71 of file ExpectationList.h.