void () { myBusConnection = myFixture.getProject().getMessageBus().connect(); myBusConnection.subscribe(ExternalAnnotationsManager.TOPIC, new DefaultAnnotationsListener() { private boolean notifiedOnce; @Override public void externalAnnotationsChangedExternally() { if (!notifiedOnce) { myExpectedEventWasProduced = true; notifiedOnce = true; } else { super.externalAnnotationsChangedExternally(); } } }); }