Let the LegacyService set IJ._context properly

That way, IJ.getContext() will return the context corresponding to
IJ.getLegacyService().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a unit test for the LegacyService

So far, it only tests that the recommended way for ImageJ 1.x plugins
to obtain the current legacy service or ImageJ2 context works as
advertised.

As we do not allow headless mode to be handled with the LegacyService
yet, we have to be careful not to execute this unit test without a
graphical user interface.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>