Why do JavaFX classes throw java.lang.ExceptionInInitializerError in a JUnit test?
I'm currently working with an e4 project that uses JavaFX plug-ins. Recently I started creating Junit tests for the plugins with fragment projects. I was able to run a test that imports a controller class after adding "-Dorg.osgi.framework.bundle.parent=ext" to the VM-Arguments.
However, when I try to use javafx.scene.control classes (Button, Label, etc.) in the test, a java.lang.ExceptionInInitializerError is thrown when I run a JUnit/JUnit Plug-in Test. From what I read, ExceptionInInitializerErrors are thrown something goes wrong when initializing a static variable or function. But simply calling
throws the error.
Is there anything I need to add to the VM Arguments or fragment project Manifest?
For those JavaFX Nodes JavaFx has to be bootstrapped, which is done by the e4 framework- it's on my todo list to make TestFX support available but that needs to be shipped from outside Eclipse because of liscensing issues