title: How to isolate other methods in the same class using EasyMock
body: <p>I have a method that invokes other method in the same class such as:</p>
  
  <pre><code>Class MyClass{
     public int methodA(){
        ...
        methodB()
        ...
     }
  
     public int methodB(){
        ...
     }
  }
  </code></pre>
  
  <p>And I just wanna test <code>methodA()</code>, so how can I isolate <code>methodB()</code> using <code>EasyMock</code>.
  My damn way is to create a fake instance of <code>MyClass</code> and inject it into the <code>methodA()</code> like this:</p>
  
  <pre><code>public int methodA(MyClass fake){
     ...
     fake.methodB();
     ...
  }
  </code></pre>
  
  <p>and expect it in my testcase:</p>
  
  <pre><code>MyClass fake = EasyMock.createMock(MyClass.class);    
  EasyMock.expect(fake.methodB()).andReturn(...);
  </code></pre>
  
  <p>Is there any better solution for this situation?</p>