I´m having issues while trying to execute a unit test using PowerMock with Mockito. I need PowerMockito to mock an static method.
These are the versions I´m using:
Yes, that was the problem. PowerMock has a dependency to javassist, so I just had to exclude that transitive dependency in my pom and later include the dependency to the fixed version of javassist. And that worked for me. Thanks!
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.22.0-GA</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
A Red Herring?
When I ran into this issue during Android development, I was a single test to an existing file.
Removing the test and re-adding one line at a time, I found that the underlying issue had to do with how TreeSet and its comparator were being instantiated.
YMMV.
Following Francisco González's answer, this is what I had to do :
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.5.5</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
<scope>test</scope>
</dependency>