cglib - How does Mockito mock interfaces? - Stack Overflow
Mockito allows for interchangeable implementations of MockMaker, but by default the implementation is the CGLib-based CglibMockMaker.
There are a few discussions online ("The Power of Proxies in Java" or "What is the difference between JDK dynamic proxy and CGLib?") about the differences between CGLib and standard Proxy objects; when mocking interfaces it seems that Proxy would be perfectly fine, but using CGLib gives you access to mocking actual classes with implementations, and committing to CGLib even beyond when strictly necessary likely makes the code much easier to follow.
Read full article from cglib - How does Mockito mock interfaces? - Stack Overflow
No comments:
Post a Comment