Add regression tests for shutdown behavior

The tests check three scenarios:

* ij.ImageJ#quit() with exitWhenQuitting set to false
* LegacyService#dispose()
* LegacyUI#dispose()

A separate integration test will be needed to test ij.ImageJ#quit() with
exitWhenQuitting set to true, since surefire and failsafe cannot support
tests that result in System.exit being called.
Add integration test to verify shutdown behavior

This test needs to use maven-invoker-plugin to run in a separate JVM,
because ImageJ1 calls System.exit(0) upon successful shutdown. We really
want to verify that indeed this action occurs.

Note that maven-surefire-plugin and maven-failsafe-plugin do not support
System.exit getting called from tests, so using maven-invoker-plugin is
the best way to go here.