Skip to main content

All Questions

5 votes
2 answers
18k views

How to pass a mock as std::unique_ptr to Class under test

I am writing some test units using googletest and googlemock and I am stuck in a problem related to C++11 smart pointers and polymorphism. Suppose you have those classes: class A { public: ...
Marco Stramezzi's user avatar
1 vote
1 answer
1k views

Mocking of non-copyable objects

I find myself often in the situation where I want to mock a non-copyable object, for example a DbHandle handle. I was going back and forth looking at different design choices, and I settled on the ...
user695652's user avatar