Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berry::CallHistory Class Reference

#include <berryCallHistory.h>

Inheritance diagram for berry::CallHistory:
Collaboration diagram for berry::CallHistory:

Public Member Functions

 berryObjectMacro (CallHistory)
 
 CallHistory ()
 
void Add (const std::string &methodName)
 
void Clear ()
 
bool VerifyOrder (const std::vector< std::string > &testNames) const throw (Poco::InvalidArgumentException)
 
bool Contains (const std::string &methodName) const
 
bool Contains (const std::vector< std::string > &methodNames) const
 
bool IsEmpty () const
 
void PrintTo (std::ostream &out) const
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
virtual QString ToString () const
 
virtual uint HashCode () const
 
virtual bool operator< (const Object *) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
virtual bool operator== (const Object *) const
 

Additional Inherited Members

- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

CallHistory is used to record the invocation of methods within a target object. This is useful during lifecycle testing for an object.

To use CallHistory ..

  1. Create a CallHistory in the target or pass one in.
  2. Invoke some test scenario.
  3. If a method is called on the target record the invocation in the call history
  4. Verify the call history after the test scenario is complete.

Each CallHistory has a target which is used to verify the method names passed to the history. If an invalid name is passed an IllegalArgumentException will be thrown.

Definition at line 54 of file berryCallHistory.h.

Constructor & Destructor Documentation

berry::CallHistory::CallHistory ( )

Creates a new call history for an object.

Parameters
targetthe call history target.

Definition at line 24 of file berryCallHistory.cpp.

Member Function Documentation

void berry::CallHistory::Add ( const std::string &  methodName)

Adds a method name to the call history.

Parameters
methodNamethe name of a method

Definition at line 29 of file berryCallHistory.cpp.

berry::CallHistory::berryObjectMacro ( CallHistory  )
void berry::CallHistory::Clear ( )

Clears the call history.

Definition at line 35 of file berryCallHistory.cpp.

bool berry::CallHistory::Contains ( const std::string &  methodName) const

Returns whether a method has been called.

Parameters
methodNamea method name
Returns
true if the method was called

Definition at line 60 of file berryCallHistory.cpp.

bool berry::CallHistory::Contains ( const std::vector< std::string > &  methodNames) const

Returns whether a list of methods were called.

Parameters
methodNamesa list of methods
Returns
true if the methods were called

Definition at line 66 of file berryCallHistory.cpp.

bool berry::CallHistory::IsEmpty ( ) const

Returns whether the list of methods called is empty.

Returns
true iff the list of methods is empty

Definition at line 77 of file berryCallHistory.cpp.

void berry::CallHistory::PrintTo ( std::ostream &  out) const

Prints the call history to the console.

Definition at line 82 of file berryCallHistory.cpp.

bool berry::CallHistory::VerifyOrder ( const std::vector< std::string > &  testNames) const
throw (Poco::InvalidArgumentException
)

Returns whether a list of methods have been called in order.

Parameters
testNamesan array of the method names in the order they are expected
Returns
true if the methods were called in order

Definition at line 40 of file berryCallHistory.cpp.


The documentation for this class was generated from the following files: