title: How to unit test that a JavaFX application launches
body: <p>I've got a JavaFX application, and I want to test if it launches or not. How would I go about doing that? Is it possible with just JUnit, or can TestFX help me in that?</p>
  
  <p>My main issue is: How do I shut down the application right after it has (succesfully) launched?</p>
  
  <p>Example application class:</p>
  
  <pre><code>public class MovieDB extends Application {
      @Override
      public void start(final Stage primaryStage) throws IOException {
          FXMLLoader fxmlLoader = new FXMLLoader(MovieDBController.class.getResource("MovieDB.fxml"), ResourceBundle.getBundle("bundles/bundle", new Locale("en")));
          Parent root = fxmlLoader.load();
  
          Scene scene = new Scene(root, 1024, 768);
  
          StyleManager.getInstance().addUserAgentStylesheet(getClass().getResource("/css/MovieDB.css").getPath());
  
          primaryStage.setTitle("MovieDB");
          primaryStage.setScene(scene);
          primaryStage.show();
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>