I'm upgrading PowerMockito to Mockito 5.2.0, While upgrading, I am facing an issue with mocking the constructor. I have tried many ways to mock the constructor, Can someone let me know how we can convert this to Mockito?
Dog dog = PowerMockito.mock(Dog.class);
PowerMockito.whenNew(Dog.class)
.withArguments(ArgumentMatchers.any(cat.class))
.thenReturn(dog);
I have also tried with this :
try (MockedConstruction<Fruit> mock = mockConstruction(Fruit.class, withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS))) {}