FXMLLoaders { public static <T> T load(Class<?> type) { return load(createFXMLLoader(type.getClassLoader()), type); } private  FXMLLoaders(); static FXMLLoader createFXMLLoader(ClassLoader classLoader); static void resetFXMLLoader(FXMLLoader loader); static void loadRoot(final Object rootController); static void loadRoot(final FXMLLoader loader, final Object rootController); static void loadRoot(final Object rootController, final ResourceBundle resourceBundle); static void loadRoot(final FXMLLoader loader, final Object rootController,
            final ResourceBundle resourceBundle); static T load(Class<?> type); static T load(FXMLLoader loader, Class<?> type); static T load(final Class<?> type, final ResourceBundle resourceBundle); static T load(final FXMLLoader loader, final Class<?> type, final ResourceBundle resourceBundle);  }
@Test @Disabled public void testLoadFxmlWithBuilderFactory() throws IOException { TestRootControllerPane controllerPane = new TestRootControllerPane(); Class<TestRootControllerPane> type = TestRootControllerPane.class; FXMLLoader loader = new FXMLLoader(); loader.setBuilderFactory(new TestBuilderFactory(loader.getBuilderFactory())); loader.setClassLoader(type.getClassLoader()); loader.setResources(ResourceBundle.getBundle(type.getPackage().getName()+".Bundle", Locale.getDefault(), type.getClassLoader())); loader.setRoot(controllerPane); loader.setController(controllerPane); String fxmlFileName = "TestRootControllerPane.fxml"; try (InputStream is = type.getResourceAsStream(fxmlFileName)) { if (is == null) { throw new FileNotFoundException(fxmlFileName); } loader.load(is); } }