In Google Mock we use theEXPECT_CALL()macro to set an expectation on a mock method. The general syntax is:

    1. EXPECT_CALL(mock_object, method(matchers))
    2. .Times(cardinality)
    3. .WillOnce(action)
    4. .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.