Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Junit Test fails for JavaFX nodes
Junit Test fails for JavaFX nodes [message #1737890] Wed, 13 July 2016 19:14 Go to next message
Matthew Montgomery is currently offline Matthew MontgomeryFriend
Messages: 5
Registered: May 2016
Junior Member
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

new Button("Test");
throws the error.

Is there anything I need to add to the VM Arguments or fragment project Manifest?

Thank you.
Re: Junit Test fails for JavaFX nodes [message #1737892 is a reply to message #1737890] Wed, 13 July 2016 19:43 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6559
Registered: July 2009
Senior Member
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
Previous Topic:How to create and run JUnit tests on FX plugins?
Next Topic:Problems exporting a Plugin
Goto Forum:

Current Time: Mon Jul 06 08:46:11 GMT 2020

Powered by FUDForum. Page generated in 0.01878 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top