Incompatibility with PowerMockRunner
See original GitHub issuewiremock-jre8, version 2.27.2 powermockito, version 2.0.4 Java 14
The annotation @RunWith(PowerMockRunner.class)
in a test case leads to the following exception:
javax.xml.transform.TransformerFactoryConfigurationError: Provider
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl could not be instantiated:
java.lang.reflect.InvocationTargetException
at java.xml/javax.xml.transform.FactoryFinder.newInstance(FactoryFinder.java:181)
at java.xml/javax.xml.transform.FactoryFinder.find(FactoryFinder.java:257)
at java.xml/javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:126)
at com.github.tomakehurst.wiremock.common.xml.Xml.optimizeFactoriesLoading(Xml.java:52)
at com.github.tomakehurst.wiremock.core.WireMockApp.<clinit>(WireMockApp.java:75)
at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:73)
at com.github.tomakehurst.wiremock.junit.WireMockRule.<init>(WireMockRule.java:43)
at com.github.tomakehurst.wiremock.junit.WireMockRule.<init>(WireMockRule.java:39)
Removing PowerMock and switching to a different runner like @RunWith(MockitoJUnitRunner.class)
fixes the issue. The cause of the exception was kinda hard to track down so maybe this could be improved.
The issue is probably related to https://github.com/tomakehurst/wiremock/issues/1072
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Incompatibility with PowerMockRunner · Issue #1392 - GitHub
Have you looked at your project dependencies when Powermock is present to see what's different and whether it can be fixed by e.g....
Read more >Powermock and mockito compatibility and changes
I am trying to move to power mock 2.0.2 and mockito 2.0. Previously I used powermock to mock some local variables: I used...
Read more >Using another JUnit Runner with PowerMock - Jayway
Here's a (contrived) example of combining PowerMock and the SpringJUnit4ClassRunner for integration testing “MyBean”. First consider the code ...
Read more >Mocking statics - Google Groups
Does anyone have any idea why "java.lang.IllegalStateException: incompatible return value type" is throws by PowerMock ? @RunWith(PowerMockRunner.class)
Read more >[#LENS-399] TestRewriting test is failing with powermock ...
Right now, TestRewriting is failing with the incompatible version of pwoermock on jdk8. We need to use latest version which is compatible for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve wrapped the optimise method in a try/catch in 882b7d044fb6f113025237c9e3ad6c27fb923b49. Curious to know if this fixes the issue if you’re able to re-test?
OK, I’m going to close this for now. Someone please shout if it’s still an issue.