mockpp::AbstractExpectation< T > Class Template Reference

Base class for all expectations. More...

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

List of all members.

Public Member Functions

 AbstractExpectation (const String &name, VerifiableList *parent)
 Constructs the expectation.
bool hasExpectations () const
 Tests if any expectations have been set on this object.
void setFailOnVerify ()
 If an incorrect actual value is set, defer reporting this as a failure until verify() is called on this object.
void clearFailOnVerify ()
 If an incorrect actual value is set, report this immediately.
virtual void clearActual ()=0
 Resets the internal state to reflect that there is no actual value set.
virtual void verify ()=0
 Verifies the contained expectation.

Protected Member Functions

void assertEquals (const String &message, const T &expectedValue, const T &actualValue) const
 Asserts that two values are equal.
bool shouldCheckImmediately () const
 Tests if any actuals should be checked immediately when set.
void setHasExpectations ()
 Tell the object to expect nothing to happen to it, perhaps because the test is exercising the handling of an error.
void clearHasExpectations ()
 Tells the object having no expectations yet.

Detailed Description

template<class T>
class mockpp::AbstractExpectation< T >

Base class for all expectations.

Definition at line 49 of file AbstractExpectation.h.


Constructor & Destructor Documentation

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

Constructs the expectation.

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

Definition at line 57 of file AbstractExpectation.h.


Member Function Documentation

template<class T>
void mockpp::AbstractExpectation< T >::assertEquals ( const String message,
const T &  expectedValue,
const T &  actualValue 
) const [inline, protected]

Asserts that two values are equal.

Parameters:
message a human readable description about the cause
expectedValue the expected value
actualValue the actual value

Definition at line 114 of file AbstractExpectation.h.

template<class T>
bool mockpp::AbstractExpectation< T >::hasExpectations (  )  const [inline, virtual]

Tests if any expectations have been set on this object.

Returns:
true: there are expectations

Implements mockpp::Expectation.

Definition at line 69 of file AbstractExpectation.h.

template<class T>
void mockpp::AbstractExpectation< T >::setHasExpectations (  )  [inline, protected]

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.

Definition at line 154 of file AbstractExpectation.h.

template<class T>
bool mockpp::AbstractExpectation< T >::shouldCheckImmediately (  )  const [inline, protected]

Tests if any actuals should be checked immediately when set.

Otherwise they are checked when verify() is called.

Returns:
true: check immediately

Definition at line 141 of file AbstractExpectation.h.

template<class T>
virtual void mockpp::AbstractExpectation< T >::verify (  )  [pure virtual]

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:58 2010 for mockpp by  doxygen 1.6.1