title: Should I mock local method invocation inside a tested method?
body: <p>My question about the concept of unit testing:</p>
  
  <pre><code>class A {
     public void m1() {
        // code
        m2();
        //code
     }
  
     public void m2() {
        //some code
     }
  
  }
  </code></pre>
  
  <p>According to best practices, how should I test the <code>m1</code> method? Is the unit the class or is the unit the method?</p>
  
  <p>My view - I should test <code>m2</code> separately and I shouldn't test <code>m1</code> and <code>m2</code> integration.</p>
  
  <p>To use my view is hard enough - I should use sophisticated frameworks for testing and use very modern things. </p>
  
  <p>According to my sense of unit testing, tests should be simple! If your code is good, you can test it without sophisticated things. But invoking m2() inside m1() is normal code.</p>
  
  <p>Please clarify my misunderstanding.</p>
  
  <h2>update:</h2>
  
  <p><strong>mocking example(pseudocode):</strong></p>
  
  <pre><code>//prepare
  A testClass = mock(A.class);
  when(testClass.m2()).doNothing();
  when(testClass.m1()).callRealMethod();
  //execute:
  testClass.m1();
  //verify
  check testClass state after method m1 invocation.
  </code></pre>
  
  <p>This is how I test a mocked class. Is this normal?</p>