I would like to make use of Powermock with Mockito to mock some static method calls. I have followed instructions and examples from SO as well as the PowerMock Getting Started
Make sure powermockito and mockito versions aligned as in this chart - https://github.com/powermock/powermock/wiki/Mockito#supported-versions,
Easy way to find is,
mvn dependency:tree | grep mockito
[INFO] | \- org.mockito:mockito-core:jar:1.8.5:compile
[INFO] +- org.mockito:mockito-all:jar:1.9.5:compile
[INFO] +- org.powermock:powermock-api-mockito:jar:1.5.6:compile
In my case, powermock 1.5.6
and mockito 1.9.5
were aligned but had to change to use mockito 1.8.5
, as someone else in the dependency was already using mockito 1.8.5.
Following combination perfectly works for me,
mvn dependency:tree | grep mockito
[INFO] | \- org.mockito:mockito-core:jar:1.8.5:compile
[INFO] +- org.mockito:mockito-all:jar:1.8.5:compile
[INFO] +- org.powermock:powermock-api-mockito:jar:1.4.9:compile