Mockito Spy – stub before calling the constructor
To answer your question directly, you cannot use Mockito to stub a method called from the constructor. Mockito needs an instance of the class before you can begin mocking, and you haven’t given yourself a way to create an instance for testing. More generally, as mentioned in Effective Java item 17, you should not call … Read more