Tests requiring AssertJ Swing as a Maven dependency encounter a NoClassDefFoundError under Pit
See original GitHub issueI have some JUnit tests for my Swing GUI using AssertJ-Swing, which work fine under other Maven test
goals, but they crash out when running Pit. In addition, my other (non-AssertJ) tests work fine with Pit.
This issue occurs for both OpenJDK 11 and OpenJDK 8.
The exact issue I am facing is that a java.lang.NoClassDefFoundError
is thrown when running any AssertJSwingJUnitTestCase
, when it tries to access org.assertj.swing.core.BasicRobot
.
I have all of my testing dependencies included in my pom.xml
, under the test
scope.
I have also tried explicitly including AssertJ JAR as additional classpath elements.
I’ve uploaded a gist of my pom.xml
here: https://gist.github.com/ben-clegg/c73660b2cdbc82d01dbdcd038fd23adb
Since this works fine with other Maven goals, I believe this is an issue with Pit. Does Pit have similar issues with other Maven dependencies, or is this unique to AssertJ? Can you suggest any workarounds?
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
As your stacktraces tell HeadlessGraphicsEnvironment will be used which fails with HeadlessException in either gist. You cannot disable headless for test minions due to #581 .
The change merged in #601 adds
-Djava.awt.headless=true
to every mutation minion created. There is only the option to add further settings but not to remove the default.So far so good. The problems seems the new default introduced in #601 .
@hcoles What do you think would be the best solution: Remove the default and warn Mac users that they should add
-Djava.awt.headless=true
themselves or should one introduce another configuration option that lets one turn headless on/off ?This will work differently in pitest 1.9.3. once #1054 is merged.
Auto adding of the jvm arg can be disabled with -Dfeatures=“-macos_focus”