use of org.eclipse.e4.core.di.IInjector in project eclipse.platform.runtime by eclipse.
the class InjectionEventTest method testEventInjectionUnsubscribe.
// NOTE: this test relies on GC being actually done on the test object.
// Java does not guarantee that to happen, so, if this test starts to fail
// intermittently, feel free to comment it
@Test
public void testEventInjectionUnsubscribe() throws InvocationTargetException, InstantiationException {
IInjector injector = InjectorFactory.getDefault();
injector.addBinding(MyBinding.class);
// do it in a separate method to ease GC
wrapSetup();
System.gc();
System.runFinalization();
System.gc();
helper.sendEvent("e4/test/event1", "wrong");
// target would have asserted if it is still subscribed
assertFalse(testFailed);
}
Aggregations