title: How to mock independent function in gmock C++?
body: <p>I am using gtest/gmock framework to write unit tests. Following is my sample code.</p>
  
  <p>In common.h,</p>
  
  <pre><code>void PreInit() {
    cout&lt;&lt;"Doing Pre-initialization."&lt;&lt;endl; 
  }
  </code></pre>
  
  <p>In test.cpp,</p>
  
  <pre><code> #include &lt;common.h&gt;
      class SampleComponent {
      public:
          void Init() {
             PreInit();
             // Do Initialization
          }
      } 
  </code></pre>
  
  <p>So far, I have been mocking classes. Any idea how to mock independent functions called by member functions of class?</p>
  
  <p>Thanks in advance.</p>