What jars do I need to add to my pom.xml
to get PowerMock working with Mockito? I have the following dependencies:
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-support</artifactId>
<version>1.4.11</version>
<scope>test</scope>
</dependency>
but when I add the @PrepareForTest
annotation at class level, Eclipse cannot find it, but it can find PowerMockito
. What jar am I missing?
You are writting:
Instead of:
I had exactly the same issue and solved it that way.
According to the Mockito_Maven page on the PowerMock wiki, use this:
powermock-api-support
seems to be "utility classes only", where you still need the core libraries provided inpowermock-module-junit4
.Make sure you have this import:
This jar has it:
Download the Mockito dependency zip file apart from your powermock-module-junit4 & powermock-api-mockito dependecies. Add that jars directly in your project it should work and configure your pom accordingly.
Power Mockito dependencies - All Jars