Mocking concrete classes with gmock is the same as mocking Astract
Base Classes - you need to mock virtual functions.
If the problem is that the code you want to test creates concrete
objects and uses them "by value" then you will need to refactor the
code to separate out responsibilities - creating an object and using
an object can be separated into separate methods. Production code
creates the real object and calls another method to us it. Test code
creates the mock object and passes that into that same "using" method
to be tested.
--
C. Keith Ray, IXP Coach, Industrial Logic, Inc.
http://industriallogic.com 866-540-8336 (toll free)
Groove with our Agile Greatest Hits: http://www.industriallogic.com/elearning/
http://agilesolutionspace.blogspot.com/
You might be better off asking why someone is asking you to attempt
the nearly impossible.
At the last resort you can use the precompiler to alter the sources
that you are trying to test.
#define ClassYouWantToMock YourMockClass
#include "CodeUnderTest.cpp"
#undef ClassYouWantToMock
class YourMockClass { ... };
// Your tests go here....
--