00001 00009 /************************************************************************** 00010 00011 begin : Thu Aug 26 2004 00012 copyright : (C) 2002-2010 by Ewald Arnold 00013 email : mockpp at ewald-arnold dot de 00014 00015 This program is free software; you can redistribute it and/or modify 00016 it under the terms of the GNU Lesser General Public License as 00017 published by the Free Software Foundation; either version 2 of the License, 00018 or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU Lesser General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00028 00029 * 00030 * Original Java Sources: Copyright (c) 2000-2004, jMock.org 00031 * 00032 00033 **/ 00034 00035 #ifndef MOCKPP_INVOKEDRECORDER_H 00036 #define MOCKPP_INVOKEDRECORDER_H 00037 00038 #include <mockpp/mockpp.h> // always first 00039 00040 #include <mockpp/matcher/TypelessMatcher.h> 00041 00042 #include <mockpp/compat/Asserter.h> 00043 #include <mockpp/compat/Formatter.h> 00044 00045 00046 MOCKPP_NS_START 00047 00048 00052 class MOCKPP_API_DECL0 InvokedRecorder : public TypelessMatcher 00053 { 00054 public: 00055 00056 typedef AutoPointer<InvokedRecorder> AP; 00057 00060 InvokedRecorder(); 00061 00064 virtual ~InvokedRecorder(); 00065 00069 int getInvocationCount() const; 00070 00074 bool hasBeenInvoked() const; 00075 00079 virtual bool matches( ); 00080 00083 virtual void incInvoked( ); 00084 00088 virtual bool hasDescription(); 00089 00094 virtual String describeTo( String &buffer ) const; 00095 00099 virtual void verify(); 00100 00104 void verifyHasBeenInvoked() const; 00105 00109 void verifyHasBeenInvokedExactly( int expectedCount ) const; 00110 00111 private: 00112 00113 int invocationCount; 00114 }; 00115 00116 00117 MOCKPP_NS_END 00118 00119 00120 #endif // MOCKPP_INVOKEDRECORDER_H 00121