Lines Matching refs:Concrete
351 ## Alternative to Mocking Concrete Classes ##
355 call it `Concrete`), you may be tempted to make the methods of
356 `Concrete` virtual and then mock it.
371 to interfaces": instead of talking to the `Concrete` class, your code
373 interface as an adaptor on top of `Concrete`. In tests, you can easily
384 …* `Concrete`'s API may not fit your problem domain very well, as you may not be the only client it…
385 …* If `Concrete`'s implementation ever has to change, you don't have to rewrite everywhere it is us…
392 …Concrete` in different ways, so the best interfaces for them will be different. Therefore, each of…
393 … just like they have been sharing `Concrete`. You can check in the interface and the adaptor somew…
567 virtual int Concrete(const char* str) { ... }
574 // Mocking a concrete method. Foo::Concrete() is shadowed.
575 MOCK_METHOD1(Concrete, int(const char* str));
579 Sometimes you may want to call `Foo::Concrete()` instead of
580 `MockFoo::Concrete()`. Perhaps you want to do it as part of a stub
581 action, or perhaps your test doesn't need to mock `Concrete()` at all
593 // Mocking a concrete method. Foo::Concrete() is shadowed.
594 MOCK_METHOD1(Concrete, int(const char* str));
596 // Use this to call Concrete() defined in Foo.
597 int FooConcrete(const char* str) { return Foo::Concrete(str); }
601 Now, you can call `Foo::Concrete()` inside an action by:
607 EXPECT_CALL(foo, Concrete(_))
611 or tell the mock object that you don't want to mock `Concrete()`:
616 ON_CALL(foo, Concrete(_))
620 (Why don't we just write `Invoke(&foo, &Foo::Concrete)`? If you do
621 that, `MockFoo::Concrete()` will be called (and cause an infinite
622 recursion) since `Foo::Concrete()` is virtual. That's just how C++