I am writing a junit of CustomerHelper which internally calls the method of AccountHelper object. The CustomerHelper is creating the AccountHelper object with new operator inside one of its method. Now if i want to mock the AccountHelper object.Is there any way i can do it?
If this dependency (AccountHelper in this case) would have been injected by some setter or constructor, i could have set my MockAccountHelper.Right? But is there any way we can do mocking when we are creating dependency with New operator?
Second question:- Is there anyway we can mock static methods using core java library without going for Power/Easy Mock?Even if i go power mocks , want to understand how it is doing it internally in brief?