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

se-edu / addressbook-level4 / 4812
94%

Build:
DEFAULT BRANCH: master
Ran 14 Dec 2018 07:15AM UTC
Jobs 1
Files 88
Run time 28s
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

pending completion
4812

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

Jobs
ID Job ID Ran Files Coverage
1 4812.1 14 Dec 2018 07:15AM UTC 0
94.32
Travis Job 4812.1
Source Files on build 4812
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #4812
  • 8e0633e5 on github
  • Prev Build on master (#4807)
  • Next Build on master (#4819)
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