In Google Mock we use theEXPECT_CALL()macro to set an expectation on a mock method. The general syntax is:
EXPECT_CALL(mock_object, method(matchers))
.Times(cardinality)
.WillOnce(action)
.WillRepeatedly(action);
Google Mock requires expectations to be setbeforethe mock functions are called, otherwise the behavior isundefined. In particular, you mustn’t interleaveEXPECT_CALL()s and calls to the mock functions.