Okay, so I just realised that this shouldn't actually work in tests. `SearchPlugin.plugin` should be `null`. It doesn't seem to affect the tests (a null pointer exception is being thrown but they still succeed, again, I don't know why) but I'll shuffle some code around so we don't reference `SearchPlugin.plugin` here - I don't like relying on a singleton. The funny thing is that it seems to break the tests in another branch I have which changes code that hasn't got anything to do with the stuff being tested here (as far as I can see).