Closed ruipacheco closed 7 years ago
You can use this same strategy with any other mocking library. It is not actually the library doing anything - you're doing all the heavy lifting by hand. Just define an equivalent interface, mock that and templatize your code on the type you actually want to use.
Or, with FakeIt and HippoMocks, add TEST_VIRTUAL to your functions and make them virtual for test purposes. Whichever approach suits you more. I tend not to like to templatize my code just for testing, on something that never changes.
Thanks!
GoogleMocks can mock non-virtual methods. Is it possible to use the same strategy with FakeIt?
https://github.com/google/googletest/blob/master/googlemock/docs/v1_7/CookBook.md#mocking-nonvirtual-methods