Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8206430

Use consistent pattern for startup in FX system tests

XMLWordPrintable

    • b09

      We have a few different patterns in use for system tests that need to startup the FX runtime, and in most cases, show a stage.

      We should consider modifying the tests to use as consistent a pattern as possible to avoid subtle difference that could affect test stability.




      ```
          @BeforeClass
          public static void initFX() throws InterruptedException {
              startupLatch = new CountDownLatch(1);
              // Start the Application
              new Thread(() -> Application.launch(TestApp.class, (String[])null)).start();
              Assert.assertTrue(startupLatch.await(15, TimeUnit.SECONDS));
          }
      ```

      NOTE: double check that the Application being launched has this code it its start() method:
      ```
      stage.setOnShown(l -> {
                      Platform.runLater(() -> startupLatch.countDown());
                  });
      ```

            angorya Andy Goryachev
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: