title: How can I tell GoogleMock to stop checking an expectation after the test finished?
body: <p>I have two unit tests that share some state (unfortunately I can't change this since the point is to test the handling of this very state).</p>
  
  <pre><code>TEST(MySuite, test1)
  {
      shared_ptr&lt;MockObject&gt; first(make_shared&lt;MockObject&gt;());
      SubscribeToFooCallsGlobal(first);
      EXPECT_CALL(*first, Foo(_));//.RetiresOnSaturation();
      TriggerFooCalls(); // will call Foo in all subscribed
  }
  
  TEST(MySuite, test2)
  {
      shared_ptr&lt;MockObject&gt; second(make_shared&lt;MockObject&gt;());
      SubscribeToFooCallsGlobal(second);
      EXPECT_CALL(*second, Foo(_)).Times(1);
      TriggerFooCalls(); // will call Foo in all subscribed
  }
  </code></pre>
  
  <p>If I run the tests separately, both are successful. If I run them in the order test1, test2, I will get the following error in <strong>test2</strong>:</p>
  
  <pre>
  mytest.cpp(42): error: Mock function called more times than expected - returning directly.
      Function call: Foo(0068F65C)
           Expected: to be called once
             Actual: called twice - over-saturated and active
  </pre>
  
  <p>The expectation that fails is the one in test1. The call does take place, but I would like to tell GoogleMock to <em>not care</em> after <code>test1</code> is complete (in fact, I only want to check expectations in a test while the test is running).</p>
  
  <p>I was under the impression that <code>RetiresOnSaturation</code> would do this, but with it I get:</p>
  
  <pre>
  Unexpected mock function call - returning directly.
      Function call: Foo(005AF65C)
  Google Mock tried the following 1 expectation, but it didn't match:
  
  mytest.cpp(42): EXPECT_CALL(first, Foo(_))...
           Expected: the expectation is active
             Actual: it is retired
           Expected: to be called once
             Actual: called once - saturated and retired
  </pre>
  
  <p>Which I have to admit, confuses me. What does it mean? How can I solve this?</p>