mockpp::ExpectationSet< T > Class Template Reference
[Basic Mock Objects]

A class to verify sets of expectations: each expected object must occur at least once. More...

Inheritance diagram for mockpp::ExpectationSet< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ExpectationSet (const String &name, VerifiableList *parent=0)
 Constructs the expectation.
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 set.
ExpectationSetaddExpected (const T &expectedItem)
 Adds another expectation value to the list.
template<class I >
ExpectationSetaddExpected (I items, I end)
 Adds a sequence of expectation values to the set.
virtual void verify ()
 Verify that the expected values equal the expected ones.
virtual void setExpectNothing ()
 Tell the object to expect nothing to happen to it, perhaps because the test is exercising the handling of an error.
virtual void reset ()
 Resets the internal state completely.
virtual void clearActual ()
 Resets the internal state to reflect that there is no actual value set.

Protected Member Functions

virtual void clearExpectation ()
 Clears the expectation list.
virtual void checkImmediateValue (const T &actualItem) const
 Checks if the actual value matches the expectation.

Detailed Description

template<class T>
class mockpp::ExpectationSet< T >

A class to verify sets of expectations: each expected object must occur at least once.

Definition at line 50 of file ExpectationSet.h.


Constructor & Destructor Documentation

template<class T>
mockpp::ExpectationSet< T >::ExpectationSet ( const String name,
VerifiableList parent = 0 
) [inline]

Constructs the expectation.

Parameters:
name human readable description about the expectation
parent parent verifiable

Definition at line 59 of file ExpectationSet.h.


Member Function Documentation

template<class T>
template<class I >
void mockpp::ExpectationSet< T >::addActual ( items,
end 
) [inline]

Adds a sequence of actual values to the set.

Parameters:
items start iterator
end terminating iterator (note: one element "behind" as always with STL)

Definition at line 85 of file ExpectationSet.h.

template<class T>
void mockpp::ExpectationSet< T >::addActual ( const T &  actualItem  )  [inline]

Adds another actual value to the list.

Parameters:
actualItem new value

Definition at line 70 of file ExpectationSet.h.

template<class T>
template<class I >
ExpectationSet& mockpp::ExpectationSet< T >::addExpected ( items,
end 
) [inline]

Adds a sequence of expectation values to the set.

Parameters:
items start iterator
end terminating iterator (note: one element "behind" as always with STL)
Returns:
reference to itself for chaining

Reimplemented in mockpp::ExpectationMap< Key, Value >.

Definition at line 111 of file ExpectationSet.h.

template<class T>
ExpectationSet& mockpp::ExpectationSet< T >::addExpected ( const T &  expectedItem  )  [inline]

Adds another expectation value to the list.

Parameters:
expectedItem new value
Returns:
reference to itself for chaining

Definition at line 96 of file ExpectationSet.h.

template<class T>
virtual void mockpp::ExpectationSet< T >::checkImmediateValue ( const T &  actualItem  )  const [inline, protected, virtual]

Checks if the actual value matches the expectation.

Note: in a set there is always only one element of a given value and the order of the elements is not relevant. If it fails, an AssertionFailedError is thrown

Implements mockpp::AbstractExpectationCollection< T >.

Definition at line 213 of file ExpectationSet.h.

template<class T>
virtual void mockpp::ExpectationSet< 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 163 of file ExpectationSet.h.

template<class T>
virtual void mockpp::ExpectationSet< T >::verify (  )  [inline, virtual]

Verify that the expected values equal the expected ones.

Note: in a set there is always only one element of a given value and the order of the elements is not relevant. If it fails, an AssertionFailedError is thrown

Implements mockpp::AbstractExpectation< T >.

Definition at line 125 of file ExpectationSet.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines

Generated on Tue Jan 5 09:48:59 2010 for mockpp by  doxygen 1.6.1