3

I want to know the compatible versions of mockito and powermockito to run with testng and java8. Tests are running fine with java 6, but when the application is upgraded to java 8, all the test cases involving powermock, fail. I also want to know if any additional dependecy is also required in the application to make tests run in java 8. Currently my maven dependencies for test are as follows :

 <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.5</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-core</artifactId>
        <version>1.5</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito</artifactId>
        <version>1.5</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-testng</artifactId>
        <version>1.5</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-support</artifactId>
        <version>1.5</version>
    </dependency>  

Any working example will do.

sam100rav
  • 3,733
  • 4
  • 27
  • 43

1 Answers1

1

How about using the latest version of each? testng 6.8 is from Sep 2012 (current is 6.9.9), mockito 1.9.5 is from Oct 2012 (current stable is 1.10.19), powermock 1.5 from Dec 2012 (current is 1.6.4) - which are all fairly outdated and before the advent of Java 8 (March 2014).

Also, try to use a property for repeated version numbers (e.g. the version of powermock), which makes it easier to change it.

Caveat: I have not tested this combination (due to lack of a test case - although requested), so I cannot guarantee that the combination of the latest stable versions as mentioned above will work. See also the respective web sites about comments on how to get everything to run properly.

Remigius Stalder
  • 1,921
  • 2
  • 26
  • 31