Mocking static method that is called multiple times
问题 I have a static method, that is used in multiple places, mostly in static initialization block. It takes a Class object as parameter, and returns the class's instance. I want to mock this static method only when particular Class object is used as parameter. But when the method is called from other places, with different Class objects, it returns null. How can we have the static method execute actual implementation in case of parameters other than the mocked one? class ABC{ void someMethod(){