The post explains the difference between doAnswer() and thenReturn() in Mockito, showcasing their usage for stubbing or mocking methods. It also demonstrates how to stub void methods using doAnswer().

4m read timeFrom feeds.feedblitz.com
Post cover image
Table of contents
1. Overview2. Dependencies3. Stubbing Methods Using thenReturn()4. Stubbing void Methods Using doAnswer()5. Conclusion

Sort: