How to write Test cases for Javafx Controllers?

I have written this test class for javafx application.

class HelloApplicationTest extends GuiTest {

@Override
protected Parent getRootNode() {
    Parent parent = null;
    try {
        parent = FXMLLoader.load((getResource("hello-view.fxml")));
        return parent;
    }
    catch (IOException ex) {

    }
    return parent;
}
@Test
void add_button() {
    Button add_btn_1=find("#add_btn");
    assertFalse(add_btn_1.disableProperty().get());
    FxAssert.verifyThat("#add_btn", LabeledMatchers.hasText("Add"));
}
}

I am getting error like this -> java.lang.NoSuchMethodError: 'java.util.Iterator javafx.stage.Window.impl_getWindows()'

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="350.0" prefWidth="666.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.fxml_db.HelloController">
   <children>
   <Label layoutX="14.0" layoutY="14.0" prefHeight="39.0" prefWidth="295.0" text="Add and View Employee:">
      <font>
        <Font name="System Bold" size="24.0" />
      </font>
   </Label>
  <Label layoutX="22.0" layoutY="93.0" prefHeight="27.0" prefWidth="124.0" text="Name:" />
  <Label layoutX="22.0" layoutY="136.0" prefHeight="27.0" prefWidth="124.0" text="Address:" />
  <Label layoutX="22.0" layoutY="181.0" prefHeight="27.0" prefWidth="124.0" text="Age:" />
  <TextField fx:id="name" layoutX="106.0" layoutY="94.0" />
  <TextField fx:id="address" layoutX="106.0" layoutY="137.0" />
  <TextField fx:id="age" layoutX="106.0" layoutY="182.0" />
  <Button fx:id="add_btn" layoutX="127.0" layoutY="223.0" mnemonicParsing="false" onAction="#add_details" text="Add" />
  <TableView fx:id="table" layoutX="342.0" layoutY="51.0" prefHeight="260.0" prefWidth="305.0">
    <columns>
      <TableColumn fx:id="idcol" prefWidth="39.33331298828125" text="ID" />
      <TableColumn fx:id="namecol" prefWidth="111.3333740234375" text="Name" />
        <TableColumn fx:id="addresscol" prefWidth="110.00003051757812" text="Address" />
        <TableColumn fx:id="agecol" prefWidth="40.6666259765625" text="Age" />
    </columns>
  </TableView>
  <Button fx:id="connect_db" layoutX="14.0" layoutY="310.0" mnemonicParsing="false" onAction="#connect" text="Connect DB" />
  <Button layoutX="200.0" layoutY="223.0" mnemonicParsing="false" onAction="#clear_data" text="Clear" />
   </children>
    </AnchorPane>

I am not able to fetch the components form the .fxml file. this is my .fxml code

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum