Good day. I am a new learner of Java and I am currently stucking in performing a unit test for javafx scene builder controller. I have an application class,
public class WebScraperApplication extends Application{
@Override
public void start(Stage stage) throws Exception{
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/ui.fxml"));
VBox root = (VBox) loader.load();
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setTitle("WebScraper");
stage.show();
}
public static void main(String args[]){
Application.launch(args);
}
}
ui.fxml stores the GUI information and Controller class is the javafx scene builder controller,
public class Controller{
@FXML
//variable and constructor
...
@FXML
//function
public int size(List<Object> x){
return x.size();
}
...
}
I have no idea to create a unit test to test the Controller class since I cannot create an object of it and implement the function inside.