mockpp::VisitableMockMethodBase Class Reference

Base of all mock methods. More...

Inheritance diagram for mockpp::VisitableMockMethodBase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 VisitableMockMethodBase (const String &name, VisitableMockObject *parent)
 Constructs the mock object.
String getMethodName (bool fully=false) const
 Gets the name of the associated method.
std::string getMethodIdentifier () const
 Gets the method identifier.
VisitableMockObjectgetVisitableMockObject () const
 Gets the parent mock object.
void unsetThrowablesInline ()
 Switches exception handling back to pre-1.2 behaviour.
void addThrowable (Throwable *t)
 Adds another throwable to the method.
template<class T >
void addThrowable (const T &w, unsigned count=1)
 Adds another throwable to the method.
void setDefaultThrowable (Throwable *t)
 Sets the default throwable.
virtual void reset ()
 Clears all expectations and puts the object in record mode again.
virtual void verify ()
 Verify the conditions which are not in the verify() chain of the visitable mock object.

Protected Member Functions

void throwAvailableException () const
 Throws an exception if available.

Protected Attributes

VisitableMockObjectvisitable
 shared internal member.
ThrowableItem defaultThrowable
 shared internal member
ThrowableList throwables
 shared internal member
bool throwablesInline
 shared internal member
std::vector< bool > throwableInsteadReturn
 shared internal member

Detailed Description

Base of all mock methods.

Definition at line 46 of file VisitableMockMethod.h.


Constructor & Destructor Documentation

mockpp::VisitableMockMethodBase::VisitableMockMethodBase ( const String name,
VisitableMockObject parent 
)

Constructs the mock object.

Parameters:
name the method name to mock
parent parent Visitable mock object

Precondition:
parent != 0
name.length() != 0

Definition at line 41 of file VisitableMockMethod.cpp.


Member Function Documentation

template<class T >
void mockpp::VisitableMockMethodBase::addThrowable ( const T &  w,
unsigned  count = 1 
) [inline]

Adds another throwable to the method.

The throwables are thrown one after the other when the method is called after activating until all of them are used.

Parameters:
w the value to throw
count how often to throw the value

Definition at line 133 of file VisitableMockMethod.h.

void mockpp::VisitableMockMethodBase::addThrowable ( Throwable t  )  [inline]

Adds another throwable to the method.

The throwables are thrown one after the other when the method is called after activating until all of them are used.

Parameters:
t a pointer to the throwable

Definition at line 118 of file VisitableMockMethod.h.

std::string mockpp::VisitableMockMethodBase::getMethodIdentifier (  )  const

Gets the method identifier.

Returns:
method identifier

Definition at line 67 of file VisitableMockMethod.cpp.

String mockpp::VisitableMockMethodBase::getMethodName ( bool  fully = false  )  const

Gets the name of the associated method.

Parameters:
fully true: return fully qualified name with parent similar to variable access syntax
Returns:
method name

Definition at line 54 of file VisitableMockMethod.cpp.

VisitableMockObject * mockpp::VisitableMockMethodBase::getVisitableMockObject (  )  const

Gets the parent mock object.

Returns:
pointer to mock object

Definition at line 73 of file VisitableMockMethod.cpp.

void mockpp::VisitableMockMethodBase::setDefaultThrowable ( Throwable t  )  [inline]

Sets the default throwable.

Once the list of throwables is empty this one is thrown. This also means that your method never processes the parameters passed to it.

Parameters:
t a pointer to the throwable

Definition at line 144 of file VisitableMockMethod.h.

void mockpp::VisitableMockMethodBase::unsetThrowablesInline (  )  [inline]

Switches exception handling back to pre-1.2 behaviour.

See also:
VisitableMockObject::Controller::unsetThrowablesInline()

Definition at line 107 of file VisitableMockMethod.h.

virtual void mockpp::VisitableMockMethodBase::verify (  )  [inline, virtual]

Verify the conditions which are not in the verify() chain of the visitable mock object.

Located here instead of the method for traditional reasons. If it fails, an AssertionFailedError is thrown

Reimplemented from mockpp::MockObject.

Reimplemented in mockpp::VisitableMockReturningMethodBase< R >.

Definition at line 167 of file VisitableMockMethod.h.


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

Generated on Tue Jan 5 09:49:15 2010 for mockpp by  doxygen 1.6.1