PowerMock/Mockito Tests are failing after Sorting pom.xml
See original GitHub issueHello, After sorting my pom.xml suddenly the tests are not running anymore. after reverting the pom.xml, it works again.
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>${version.sortpom-maven-plugin}</version>
<configuration>
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
<keepBlankLines>true</keepBlankLines>
<encoding>${project.build.sourceEncoding}</encoding>
<sortDependencies>scope,artifactId</sortDependencies>
<sortPlugins>groupId,artifactId</sortPlugins>
<sortProperties>false</sortProperties>
<sortModules>true</sortModules>
<createBackupFile>false</createBackupFile>
<ignoreLineSeparators>false</ignoreLineSeparators>
<nrOfIndentSpace>4</nrOfIndentSpace>
<indentBlankLines>false</indentBlankLines>
</configuration>
</plugin>
java.lang.ExceptionInInitializerError
at my.project.pkg.esb.dispatch.MessageDispatcherTest.setUp(MessageDispatcherTest.java:102)
Caused by: java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.StackTraceCleanerProvider (alternate: null)
at my.project.pkg.esb.dispatch.MessageDispatcherTest.setUp(MessageDispatcherTest.java:102)
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.StackTraceCleanerProvider implementation declared in java.lang.CompoundEnumeration@47cb2624
at my.project.pkg.esb.dispatch.MessageDispatcherTest.setUp(MessageDispatcherTest.java:102)
Caused by: java.lang.ClassCastException: **Cannot cast org.powermock.api.mockito.internal.exceptions.StackTraceCleanerProvider to org.mockito.plugins.StackTraceCleanerProvider**
at my.project.pkg.esb.dispatch.MessageDispatcherTest.setUp(MessageDispatcherTest.java:102)
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
dropwizard + Powermock + Mockito + Maven build error with ...
1 Answer 1 ... when you are defining the power mock jars in pom.xml, you don't need to explicitly define dependent jars as...
Read more >Java 11 compatibility with inline mocks · Issue #1483 - GitHub
Using the latest version of Mockito (2.22.0), simply adding the following as a test dependency to my pom.xml allowed the tests to run ......
Read more >PowerMock tests work fine in Eclipse, but don't execute in ...
I'm trying to write some tests using PowerMock. I got the PowerMock test working fine in Eclipse, but now I'm noticing that the...
Read more >How to Fix A "Mockito cannot mock this class" Exception in A ...
IllegalStateException: Failed to load ApplicationContext Caused by: org.mockito.exceptions.base.MockitoException: Mockito cannot mock this ...
Read more >Maven Surefire Plugin – Using JUnit
Use mvn dependency:tree , POM dependency ordering and/or ... Failing to add the proper test-frameworks will result in a build failure.
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 FreeTop 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
Top GitHub Comments
I have been using SortPom together with Jenkins, but then I use the verify goal instead. Each developer must sort the pom (often just by building the project) before they make a checkin.
The verify goal will fail the build if the pom is not sorted, same as it fails the build if tests are not successful.
So the Jenkins server will never sort the pom
thanks for the advices and hints. i’m getting rid of easymock. that is the best way. ticket can be closed.
other Question: what is your experience with sortpom-plugin plus Jenkins CI. Currently i have to tell my Jenkins-Job to clean checkout from SVN, otherwise there will be always an merge conflict in pom.xml when run the job the second time.