Google mock ByRef method
问题 I have a class that takes a boolean as a reference parameter and returns an integer: class Foo { public: Bar my_bar; virtual int myMethod(bool &my_boolean) = 0; } /*...*/ int Foo::myMethod(bool &my_boolean){ if (my_bar == NULL){ my_boolean = false; return -1; } else{ my_boolean = true; return 0; } } And I created a mock for this class: class MockFoo : public Foo { MOCK_METHOD1(myMethod,int(bool &my_boolean)); } I'm having problems on how to set the expectations for this kind of function