title: Verify a mocked object's method
body: <p>Say I have a class like this:</p>
  
  <pre><code>public class Foo {
      private Bar bar;
      public Foo(Bar bar) {
          this.bar = bar;
      }
  
      public void someMethod() {
          bar.someOtherMethod();
      }
  }
  </code></pre>
  
  <p>How would I verify that bar.someOtherMethod() is called once when someMethod() is called?  In my test, I am passing in a mocked Bar class into the constructor.</p>
  
  <p>My test looks something like this:</p>
  
  <pre><code>private Bar bar;
  private Foo foo;
  
  @Before
  public void setUp() throws Exception {
      bar = mock(Bar.class);
      foo = new Foo(bar);
  }
  
  @Test
  public void testSomeMethod() {
      foo.someMethod();
      verify(Bar).someOtherMethod();
  }
  </code></pre>