The text "callback called" from Callback() prints to console, but gmock fails the test saying that no callback happened. What am I doing wrong?
class MyClass
{
public:
MyClass() { };
virtual ~MyClass() { };
void Callback() { printf("callback called\n"); };
};
class MyClassMock : public MyClass
{
public:
MOCK_METHOD0(Callback, void());
};
class Caller
{
public:
Caller(MyClass *myClass) { m_myClass = *myClass; };
void Call() { m_myClass.Callback(); };
private:
MyClass m_myClass;
};
TEST(BasicTest, Positive)
{
MyClassMock mock;
EXPECT_CALL(mock, Callback()).Times(1);
Caller caller(&mock);
caller.Call();
}