/**
  * @param node
  * @return
  */
 public static Tooltip create(Node node) {
   Tooltip tooltip = new Tooltip();
   node.setOnMouseEntered(
       (MouseEvent event) -> {
         Point2D p =
             node.localToScreen(
                 node.getLayoutBounds().getMaxX() / 2,
                 node.getLayoutBounds().getMaxY()
                     + 5); // I position the tooltip at bottom right of the node (see below for
         // explanation)
         tooltip.show(node, p.getX(), p.getY());
       });
   node.setOnMouseExited(
       (MouseEvent event) -> {
         tooltip.hide();
       });
   return tooltip;
 }
  protected void fakeClick(String query) {
    baseFXRobot.waitForIdle();
    Node node = waitForNode(query);
    Point2D pos = robot.point(node).getPosition();
    baseFXRobot.mouseMove((int) pos.getX(), (int) pos.getY());
    Point2D screenPos = node.localToScreen(pos.getX(), pos.getY());
    Point2D scenePos = node.localToScene(pos.getX(), pos.getY());

    if (node instanceof Region && !(node instanceof Control)) {
      throw new IllegalArgumentException("cannot fake clicks on random regions");
    }

    runLaterAndWait(() -> waitForNode(query).requestFocus());
    if (focusSufficesClick(node)) {
      return;
    }

    MouseEvent event =
        new MouseEvent(
            MouseEvent.MOUSE_CLICKED,
            pos.getX(),
            pos.getY(),
            screenPos.getX(),
            screenPos.getY(),
            MouseButton.PRIMARY,
            1,
            false,
            false,
            false,
            false,
            false,
            false,
            false,
            true,
            false,
            false,
            new PickResult(node, scenePos.getX(), scenePos.getY()));

    EventHandler<? super MouseEvent> pressedHandler = node.getOnMousePressed();
    EventHandler<? super MouseEvent> clickedHandler = node.getOnMouseClicked();
    EventHandler<? super MouseEvent> releasedHandler = node.getOnMouseReleased();

    Platform.runLater(
        () -> {
          if (pressedHandler != null) {
            pressedHandler.handle(event);
          }
          if (clickedHandler != null) {
            clickedHandler.handle(event);
          }
          if (releasedHandler != null) {
            releasedHandler.handle(event);
          }
          if (pressedHandler == null && clickedHandler == null && releasedHandler == null) {
            node.buildEventDispatchChain(new EventDispatchChainImpl()).dispatchEvent(event);
          }
        });

    if (fireSufficesClick(node)) {
      Platform.runLater(((ButtonBase) node)::fire);
      return;
    }
  }