I am trying to use powermock and mockito with spring. I have used them before but without spring. Spring-cloud-stream-test-support already provides the JUnit4.12
, and some other dependencies come with it. Mockito is also running fine with this version of JUnit.
But, I have to mock some static method calls, so I need to use Powermock. I have tried to include Powermock with these versions of JUnit and Mockito.
- junit:junit:4.12
- org.mockito:mockito-core:2.8.0
- org.powermock:powermock-api-mockito2:1.7.0RC2
- org.powermock:powermock-module-junit4:1.7.0
- org.powermock:powermock-core:1.7.0
- org.powermock:powermock-module-junit4-rule:1.7.0
as suggested by this answer. But there is no Mockito-core:2.8.0
. So, I tried to combine it with other versions, but they all throw some kind of hard to resolve exception.
For example, I tried, Mockito-Core:2.8.9
, it throws,
java.lang.NoSuchMethodError: org.mockito.mock.MockCreationSettings.getConstructorArgs()
Mockito-all comes with mockito-core, but when I dont provide mockito-core explicitly, it throws,
java.lang.NoSuchMethodError: org.mockito.mock.MockCreationSettings.getConstructorArgs()
I have tried to isolate the errors and trace them to issues in that testing framework version, but that seems to never end. Can someone suggest what are the compatible versions?