FxUtils { public static MenuItem menuItem(String text, EventHandler<ActionEvent> eventHandler) { MenuItem menuItem = new MenuItem(text); menuItem.setOnAction(eventHandler); return menuItem; } private  FxUtils(); static CompletableFuture<Boolean> runOnFxThread(Runnable task); static void bind(Property<T> property,
                                    ObservableMap<K, V> map,
                                    K key,
                                    Function<V, T> converter); static void bind(Property<T> property, DataSource<T> dataSource); static void bind(ObservableList<? super T> list,
                              ObservableValue<? extends List<? extends T>> observable); static void bindBidirectional(Property<T> property, DataSource<T> dataSource); static When when(Property<Boolean> condition); static String toHexString(Color color); static MenuItem menuItem(String text, EventHandler<ActionEvent> eventHandler); static MenuItem menuLabel(String text); static Optional<Label> getLabel(Node node); static void setController(Node node, Object controller); static T getController(Node node); static N load(Class<?> controllerClass); static void requestClose(Window window);  }
@Test public void menuItemTest() { CompletableFuture<Boolean> future = new CompletableFuture<>(); MenuItem menuItem = FxUtils.menuItem("Test item", event -> future.complete(true)); menuItem.fire(); assertTimeoutPreemptively(Duration.ofSeconds(5), future::join); }