title: How to test a method that is invoking methods of another class?
body: <p>I'm trying to understand how to do unit testing with Mockito. 
  All the cases that I found is when a class A depends on a class B, that is A has an attribute of type B. I understand well this case. But how to do the tests when A uses B without getting it as attribute.</p>
  
  <p>Suppose I have this code:</p>
  
  <pre><code>import package.classB;
  public class A
  {
      public int methodA(classB b) 
      {
      int x= b.methodB();
      //do something with x and then return the result
      }
  }
  </code></pre>
  
  <p>How can I test the methodA?  Do I need to use mocks in this case?</p>