title: Is it a right case for Mockito spy?
body: <p>Let's say I have a class</p>
  
  <pre><code>class SomeClass
  {
    public void methodA()
    {}
  
    public void methodB()
    {}
  
    public void someMethod()
    {
       methodA();
       methodB();
    }
  }
  </code></pre>
  
  <p>I would like to test behavior of someMethod() with Mockito. </p>
  
  <p>The only way I could think of is using spy();</p>
  
  <p>Something like </p>
  
  <pre><code>SomeClass someClass = spy(new SomeClass());
  someClass.someMethod();
  InOrder inOrder = inOrder(someClass);
  inOrder.verify(someClass).methodA();
  inOrder.verify(someClass).methodB();
  </code></pre>
  
  <p>I'm new to the mockito and documentation says </p>
  
  <p>"Real spies should be used carefully and occasionally, for example when dealing with legacy code."</p>
  
  <p>So maybe I'm missing something and there is better (right) way to verify that methodA and methodB were called without explicitly calling them in the test case. </p>
  
  <p>Thanks.</p>