title: Actual function call count doesn't match EXPECT_CALL(*mock, display())
body: <p>I'm calling <code>EXPECT_CALL</code> on a mocked function <code>display()</code>, but it is returning the run time error </p>
  
  <blockquote>
    <p><code>Actual function call count doesn't match EXPECT_CALL(*mock, display())...</code></p>
  </blockquote>
  
  <h2>output</h2>
  
  <pre><code>./GTest_static_example.tst
  
  [==========] Running 1 test from 1 test case.
  [----------] Global test environment set-up.
  [----------] 1 test from GTest_static_example
  [ RUN      ] GTest_static_example.case1
  inside the GTEST_static_class:: display
  display called from GTest_static_example
  package/web/webscr/GTest_static_example.cpp:70: Failure
  Actual function call count doesn't match EXPECT_CALL(*mock, display())...
           Expected: to be called once
             Actual: never called - unsatisfied and active
  [  FAILED  ] GTest_static_example.case1 (0 ms)
  [----------] 1 test from GTest_static_example (0 ms total)
  
  [----------] Global test environment tear-down
  [==========] 1 test from 1 test case ran. (0 ms total)
  [  PASSED  ] 0 tests.
  [  FAILED  ] 1 test, listed below:
  [  FAILED  ] GTest_static_example.case1
  
   1 FAILED TEST
  </code></pre>
  
  <h2>GTEST_static_class.h</h2>
  
  <pre><code>#include&lt;iostream&gt;
  
  using namespace std;
  class GTEST_static_class
  {   
      public:
      GTEST_static_class()
      {}
  
      void display()
      {
          cout&lt;&lt; "inside the GTEST_static_class:: display " &lt;&lt;endl;
      } 
  };
  </code></pre>
  
  <h2>GTest_static_example.cpp</h2>
  
  <pre><code>#include &lt;gtest/gtest.h&gt;
  #include &lt;gmock/gmock.h&gt;
  #include &lt;iostream&gt;
  #include "GTEST_static_class.h"
  
  using namespace std;
  using ::testing::Return;
  
  
  class GTest_static_example : public::testing::Test
  {
      public:
      virtual void SetUp();
      virtual void TearDown();
      void call_display()
      {
          GTEST_static_class *_class = new GTEST_static_class();
          _class-&gt;display();
          cout&lt;&lt;"display called from GTest_static_example"&lt;&lt;endl;
      }
  
  };
  
  
  class MockGTEST_static_class : public GTEST_static_class
  {
      public:
      MockGTEST_static_class():GTEST_static_class()
      {}
  
      MOCK_METHOD0(display, void()); 
  };
  
  
  int main(int argc, char* argv[])
  {
      ::testing::InitGoogleTest(&amp;argc, argv);
      return RUN_ALL_TESTS();
  }
  
  void GTest_static_example::SetUp()
  {}
  
  void GTest_static_example::TearDown()
  {}
  
  TEST_F(GTest_static_example, case1)
  {
      MockGTEST_static_class *mock = new MockGTEST_static_class();
      EXPECT_CALL(*mock,display()).WillOnce(Return());
      call_display();
      delete mock;
  }
  </code></pre>