Lines Matching refs:Concrete
358 ## Alternative to Mocking Concrete Classes ##
362 call it `Concrete`), you may be tempted to make the methods of
363 `Concrete` virtual and then mock it.
378 to interfaces": instead of talking to the `Concrete` class, your code
380 interface as an adaptor on top of `Concrete`. In tests, you can easily
391 …* `Concrete`'s API may not fit your problem domain very well, as you may not be the only client it…
392 …* If `Concrete`'s implementation ever has to change, you don't have to rewrite everywhere it is us…
399 …Concrete` in different ways, so the best interfaces for them will be different. Therefore, each of…
400 … just like they have been sharing `Concrete`. You can check in the interface and the adaptor somew…
574 virtual int Concrete(const char* str) { ... }
581 // Mocking a concrete method. Foo::Concrete() is shadowed.
582 MOCK_METHOD1(Concrete, int(const char* str));
586 Sometimes you may want to call `Foo::Concrete()` instead of
587 `MockFoo::Concrete()`. Perhaps you want to do it as part of a stub
588 action, or perhaps your test doesn't need to mock `Concrete()` at all
600 // Mocking a concrete method. Foo::Concrete() is shadowed.
601 MOCK_METHOD1(Concrete, int(const char* str));
603 // Use this to call Concrete() defined in Foo.
604 int FooConcrete(const char* str) { return Foo::Concrete(str); }
608 Now, you can call `Foo::Concrete()` inside an action by:
614 EXPECT_CALL(foo, Concrete(_))
618 or tell the mock object that you don't want to mock `Concrete()`:
623 ON_CALL(foo, Concrete(_))
627 (Why don't we just write `Invoke(&foo, &Foo::Concrete)`? If you do
628 that, `MockFoo::Concrete()` will be called (and cause an infinite
629 recursion) since `Foo::Concrete()` is virtual. That's just how C++