squash! LegacyInjector: for testing, accept a fully-initialized CodeHacker

But do not set LegacyService in that case.
LegacyTestUtils: offer to write ImageJ 1.x-style plugin .jar files

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Turn the ij-legacy class loader integration into a simple unit test

It is much easier to debug a simple unit test than integration tests.
In the case of the ij-legacy class loder tests, we made them integration
tests only so that we would have a fresh class loader, unencumbered from
any patched or unpatched ImageJ 1.x classes.

But we just needed to refactor the legacy headless tests which created
exactly such a class loader.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyTestUtils: the LegacyInjector's and ij.IJ's class loader must match

Otherwise, LegacyInjector's setLegacyService() tries to assign a new
instance of DummyLegacyService to ij.IJ._service, but that fails because
the DummyLegacyService and the type of ij.IJ._service were loaded with
different class loaders and are therefore incompatible.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CodeHacker: make sure that a PluginClassLoader is instantiated

Otherwise, ij1.plugins.dirs is not heeded!

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move getFreshIJ1ClassLoader to IJ1Helper

It is probably more useful than just for tests.

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