title: EasyMock expectations with void methods
body: <p>I'm using EasyMock to do some unit tests and I don't understand the usage of <code>EasyMock.expectLastCall()</code>. As you can see in my code below, I have an object with a method that returns void getting called in some other object's method. I would think that I have to make EasyMock expect that method call, but I tried commenting out the <code>expectLastCall()</code> invocation and it still works. Is it because I passed <code>EasyMock.anyObject())</code> that it registered it as an expected call or is there something else going on?    </p>
  
  <pre><code>MyObject obj = EasyMock.createMock(MyObject.class);
  MySomething something = EasyMock.createMock(MySomething.class);
  EasyMock.expect(obj.methodThatReturnsSomething()).andReturn(something);
  
  obj.methodThatReturnsVoid(EasyMock.&lt;String&gt;anyObject());
  
  // whether I comment this out or not, it works
  EasyMock.expectLastCall();
  
  EasyMock.replay(obj);
  
  // This method calls the obj.methodThatReturnsVoid()
  someOtherObject.method(obj);
  </code></pre>
  
  <p>The API doc for EasyMock says this about <code>expectLastCall()</code>: </p>
  
  <pre><code>Returns the expectation setter for the last expected invocation in the current thread. This method is used for expected invocations on void methods.
  </code></pre>