Base of all mock methods. More...
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. | |
VisitableMockObject * | getVisitableMockObject () 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 | |
VisitableMockObject * | visitable |
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 |
Base of all mock methods.
Definition at line 46 of file VisitableMockMethod.h.
mockpp::VisitableMockMethodBase::VisitableMockMethodBase | ( | const String & | name, | |
VisitableMockObject * | parent | |||
) |
Constructs the mock object.
name | the method name to mock | |
parent | parent Visitable mock object |
Definition at line 41 of file VisitableMockMethod.cpp.
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.
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.
t | a pointer to the throwable |
Definition at line 118 of file VisitableMockMethod.h.
std::string mockpp::VisitableMockMethodBase::getMethodIdentifier | ( | ) | const |
Gets the 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.
fully | true: return fully qualified name with parent similar to variable access syntax |
Definition at line 54 of file VisitableMockMethod.cpp.
VisitableMockObject * mockpp::VisitableMockMethodBase::getVisitableMockObject | ( | ) | const |
Gets the parent 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.
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.
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.