I have a scenario where I expect some calls on a function on the mock object, and then for certain code path I need to ensure that function is not called, and after that, it is called. Is there any way to do this?
EXPECT_CALL(mockObj, 1);
foo(1);
// Expect this call at the first invocation of foo(2)
EXPECT_CALL(mockObj, 2);
foo(2);
// These calls should not call my mockObj again, the above expectation is
// intended for the first invocation of foo(2)
foo(2);
foo(2);
// And now, i expect it to be called
EXPECT_CALL(mockObj, 3);
foo(3);
I could may be check that EXPECT_CALL(mockObj, 2); is called only the expected number of times, But i also want to confirm that it is called only at the first call to foo(2) and not at the subsequent calls to foo(2). Can you please let me know of any way to achieve this in gmock?