What does the annotation @PrepareForTest in PowerMockito really mean?
@PrepareForTest
What should be placed there apart of classes which have static methods?
That annotation tells PowerMock(ito) that the listed classes will need to be manipulated on the byte code level.
You need to "prepare for test" all these classes X of which you want to
new()
PowerMockito.when(spy, "privateMethodNameAsString").then...
In other words:
X.doStatic()
new Y(...)
new
1.4m articles
1.4m replys
5 comments
57.0k users