Mockito junit 5 mock constructor

Viewed 6564

I want to mock a constructor and return a mock object when the constructor is called. This can be achieved using powermockito's whenNew method like this.

PowerMockito.whenNew(ClassName.class).withAnyArguments().thenReturn(mockObject);

Since Junit5 doesn't have powermockito support yet, I need to know if this can be achieved using Mockito.

1 Answers
Related