title: Capture Arguments from Chained Methods Using Mockito
body: <p>I'm writing some Java unit tests for an existing class using Mockito. However, I'm having trouble extracting the arguments with which an object of this class is calling a method as part of a nested call.</p>
  
  <p>Example:</p>
  
  <pre><code>public class SomeClass {
  
    public SomeClass() {
      //...
    }
  
    public someMethod(Foo foo) {
      // Bar bar = ...
      someOtherMethod(bar);
    }
  
    private someOtherMethod(Bar bar) {
      //...
    }
  }
  </code></pre>
  
  <p>I want to capture the arguments to <code>someOtherMethod()</code> and verify that <code>bar</code> is what it should be. Can I do this using <code>ArgumentCaptor</code> or other functionality within Mockito?</p>