Mocking methods of local scope objects with Mockito
The answer from @edutesoy points to the documentation of PowerMockito and mentions constructor mocking as a hint but doesn’t mention how to apply that to the current problem in the question. Here is a solution based on that. Taking the code from the question: public class MyClass { void method1 { MyObject obj1 = new … Read more