title: Google Mock Actual function call count doesn't match EXPECT_CALL
body: <p>I am new to Google Mock and was trying my hand with this code, I also checked this link.</p>
  <p><a href="https://stackoverflow.com/questions/15757479/">Actual function call count doesn&#39;t match EXPECT_CALL(*mock, display())</a></p>
  <p>but was not able to get proper input.</p>
  <p>Base.cc</p>
  <pre><code>class Base
  {
      int val;
      string msg;
      public:
      Base():val(0), msg(&quot;world&quot;){}
      virtual ~Base(){}
      virtual void set(int x, string msg)
      {
              this-&gt;val = val;
              this-&gt;msg = msg;
      }
      virtual void get()
      {
              cout &lt;&lt; &quot;val    :&quot; &lt;&lt; this-&gt;val &lt;&lt; endl;
              cout &lt;&lt; &quot;msg    :&quot; &lt;&lt; this-&gt;msg &lt;&lt; endl;
      }
  };
  class MockBase : public Base
  {
      public:
      MOCK_METHOD0(get, void());
      MOCK_METHOD2(set, void(int val, string msg));
  };
  </code></pre>
  <p>Base_unittest.cc</p>
  <pre><code>int main(int argc, char * argv[])
  {
      std::cout &lt;&lt; &quot;in main&quot; &lt;&lt; endl;
      ::testing::InitGoogleTest(&amp;argc,argv);
      return RUN_ALL_TESTS();
  }
  TEST(Base, case1)
  {
      MockBase obj;
      EXPECT_CALL(obj, get()).WillOnce(::testing::Return());
  }
  TEST(Base, case2)
  {
      MockBase obj;
      EXPECT_CALL(obj, set(2,&quot;hello&quot;)).WillOnce(::testing::Return());
  }
  </code></pre>
  <p>I am getting error:</p>
  <blockquote>
  <p>Actual function call count doesn't match EXPECT_CALL(obj, get())...</p>
  <p>Actual function call count doesn't match EXPECT_CALL(obj, set(2,&quot;hello&quot;))...</p>
  </blockquote>
  <p>So please help and if any tutorials for newbies please refer.</p>