Search code examples
javamockitopowermockpowermockito

What dependency to add in maven pom for using powermock with mockito1?


Powermockito doc shows the below dependency to add in a pom.

<properties>
    <powermock.version>2.0.2</powermock.version>
</properties>
<dependencies>
   <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
   </dependency>
   <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-mockito</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
   </dependency>
</dependencies>

But there is no powermock-api-mockito with version 2.0.2. As per the supported versions powermockito 2.0 is supposed to work with mockito 1.10.x.

Can someone let me know what dependency I have to add in maven pom for powermock 2 to work with the latest Mockito1 version (1.10.19)?


Solution

  • This has been answered here.

    Reposting the relevant answer here

    This still needs to be changed. documentation is accurate under the supported versions further in the mockito support docs here:

    https://github.com/powermock/powermock/wiki/Mockito#supported-versions So 2.0.2 needs to be changed to 1.7.4 for mockito1. at the top of the docs where you can find the pom configuration, it is noted that powermock2 does not support mockito1. Please change this.