I am trying to mock an abstract class but I keep getting compiling errors from inside the GMock headers. I can't share the actual code, but is almost the same as bellow. The mocking was working fine, but I had to change the "DoStuff" function to take an object but reference. Since then it doesn't compile. The error is something like * GMock can't compare "Element" to long long *.
"C++ code"
using ::testing::NiceMock;
class Element{};
class Foo
{
public:
virtual void DoStuff(Element&) = 0;
};
class MockFoo : public Foo
{
public:
MockFoo() {};
MOCK_METHOD1(DoStuff, void(Element&));
};
TEST(example, test)
{
NiceMock<MockFoo> mf;
Element element{};
EXPECT_CALL(mf, DoStuff(element)).Times(1);
mf.DoStuff(element);
}