Replacing PowerMock’s @PrepareForTest programmatically?
What you try to achieve will not work. The problem is that powermock must rewrite the client class’s code to intercept the static invocation and it can’t do this after the class is loaded. Thus it can only prepare a class for test before it is loaded. Let’s assume you want to mock the System.currentTimeMillis … Read more