ISIS-351: fixing some broken tests

... sorry about that, should've done this before I pushed.

The breakage was because of errors in the tests, that were being masked before.  Previously,
a test could call flush() on a committed transaction.  This didn't matter because
flush() would be a no-op if there were no queued commands.

Now, however, the flush continues, because - for the JDO object store - not every update
is wrapped as a command.  This caused a guard to trigger, failing the tests.

The fix was to make sure that a transaction was correctly in progress, using
@Before and @After (or equivalent).

There was also a one-liner guard in the ServicesInjector to allow for a null container
when caching services by type.  This wouldn't happen in production but does happen
in one of the tests for this class (ServicesInjectorDefault).