I have a class Foo
that references multiple other objects of type IBar
. The class has a method fun
that needs to invoke method f
This can be achieved using check points:
using ::testing::MockFunction;
MockFunction<void()> check_point;
EXPECT_CALL(*bar1, frob())
.Times(AtMost(1))
.WillRepeatedly(
InvokeWithoutArgs(&check_point, &MockFunction<void()>::Call);
EXPECT_CALL(*bar2, frob())
.Times(AtMost(1))
.WillRepeatedly(
InvokeWithoutArgs(&check_point, &MockFunction<void()>::Call);
EXPECT_CALL(check_point, Call())
.Times(Exactly(1));