What happens when when()
is invoked in Mockito?
Given the following mockito when() statement:
when(mock.method()).thenReturn(someValue);
How does Mockito create a proxy for the mock, considering that mock.method()
is executed before being passed to when()
?
I assume this involves some CGLib or bytecode manipulation, but I’d like to understand the technical details of how this works.