• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

se-edu / addressbook-level4 / 4812 / 1
94%
master: 94%

Build:
DEFAULT BRANCH: master
Ran 14 Dec 2018 07:15AM UTC
Files 88
Run time 27s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Dec 2018 07:10AM UTC coverage: 94.322% (+0.8%) from 93.542%
4812.1

push

travis-ci

pyokagan
MainApp: don't forcefully terminate the application on exit

When MainApp receives an ExitAppRequestEvent, it forcefully terminates
the application with:

    Platform.exit();
    System.exit(0);

However, this makes testing the `exit` command extremely hard. This is
because in the JUnit environment, calling System.exit(...) will cause
the test runner to terminate as well, causing tests to not properly be
run. Likewise, TestFX expects the JavaFX event loop to be running for
the entire duration of all tests, and thus calling Platform.exit() will
cause TestFX to become stuck [1]. As such, tests such as
MainWindowCloseTest work around this by checking to see if the
ExitAppRequestEvent is raised instead.

But really, we don't need to call Platform.exit() or System.exit().
This is because by default, once all windows are closed, JavaFX will
automatically begin the shutdown process and call Application#stop().

As such, let's tweak our implementation so that we trigger JavaFX
shutdown by closing all windows -- namely, closing all MainWindows and
HelpWindows.

This is accomplished by shifting the handling of ExitAppRequestEvent to
MainWindow. MainWindow will handle it by hiding itself and its
HelpWindow. Since there can only be one HelpWindow to each MainWindow,
and all MainWindows will respond to the ExitAppRequestEvent, this would
essentially cause all open windows to be hidden.

Likewise, MainWindowCloseTest does not need to check for
ExitAppRequestEvent any more -- it can simply check if all windows are
closed (and the JavaFX framework shutdown is thus implied). This would
make it more like a black box test and thus more resilient to changes in
internal implementation details in the future.

[1] See 088db25e (MainWindow.fxml: update onCloseRequest event to call
    handleExit(), 2018-02-16) for a discussion of these issues.

1412 of 1497 relevant lines covered (94.32%)

0.94 hits per line

Source Files on job 4812.1
  • Tree
  • List 0
  • Changed 8
  • Source Changed 8
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 4545
  • Travis Job 4812.1
  • 8e0633e5 on github
  • Prev Job for on master (#4807.1)
  • Next Job for on master (#4819.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc