Class JavaFXThreadingRule

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    public class JavaFXThreadingRule
    extends java.lang.Object
    implements org.junit.rules.TestRule
    A JUnit Rule for running tests on the JavaFX thread and performing JavaFX initialisation. To include in your test case, add the following code:
     @Rule
     public JavaFXThreadingRule jfxRule = new JavaFXThreadingRule();
     
    Author:
    Andy Till
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static boolean jfxIsSetup
      Flag for setting up the JavaFX, we only need to do this once for all tests.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement statement, org.junit.runner.Description description)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • jfxIsSetup

        private static boolean jfxIsSetup
        Flag for setting up the JavaFX, we only need to do this once for all tests.
    • Constructor Detail

      • JavaFXThreadingRule

        public JavaFXThreadingRule()
    • Method Detail

      • apply

        public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement statement,
                                                       org.junit.runner.Description description)
        Specified by:
        apply in interface org.junit.rules.TestRule