GMock passing a mocked object into another, and calling a stubed method is still calling real logic
问题 I'm trying to pass a mocked object to another object's method and call it, i get the same result as I would call real method. fooa.h - this is the real class #ifndef FOOA_H #define FOOA_H class FooA { public: FooA(); virtual int method(int a, int b, int c, int d); }; #endif // FOOA_H fooa.cpp #include "fooa.h" FooA::FooA() { } int FooA::method(int a, int b, int c, int d) { return a+b+c+d; } mockedfooa.h - mocked version of fooa #ifndef MOCKEDFOOA_H #define MOCKEDFOOA_H #include "fooa.h"