title: How does mockito when() invocation work?
body: <p>Given the following Mockito statement:</p>
  
  <pre><code>when(mock.method()).thenReturn(someValue);
  </code></pre>
  
  <p>How does Mockito go about creating a proxying something for a mock, given that the mock.method() statement will pass the return value to when()? I imagine that this uses some CGLib stuff, but would be interested to know how this is technically done. </p>