powermock

A method to mock a new instance in the class is using the powermockito. Powermockito has a function whenNew. This one can be used to solve this kind of problem.

How to mock a new instance

Which kind of possibility do we have in order to mock a new instance in the class which we want to test.
Subscribe to powermock