use of org.eclipse.xtext.ui.shared.internal.SharedStateContributionRegistryImpl in project xtext-eclipse by eclipse.
the class SharedStateContributionRegistryImplTest method testCreateContributingInjector.
@Test
public void testCreateContributingInjector() {
SharedStateContributionRegistryImpl registry = new SharedStateContributionRegistryImpl(injector);
Injector myInjector = registry.createInjectorWithoutJITBindings(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(CharSequenceClient.class).to(CharSequenceClientImpl.class);
}
});
Assert.assertEquals("fromParentInjector", myInjector.getInstance(CharSequenceClient.class).getSeq());
Assert.assertNotNull(myInjector.getExistingBinding(Key.get(CharSequenceClientImpl.class)));
Assert.assertNotNull(myInjector.getExistingBinding(Key.get(CharSequenceClient.class)));
Assert.assertNotNull(myInjector.getExistingBinding(Key.get(CharSequence.class)));
Assert.assertNotNull(myInjector.getExistingBinding(Key.get(String.class)));
Assert.assertNull(injector.getExistingBinding(Key.get(CharSequenceClientImpl.class)));
Assert.assertNull(injector.getExistingBinding(Key.get(CharSequenceClient.class)));
Assert.assertNotNull(injector.getExistingBinding(Key.get(CharSequence.class)));
Assert.assertNotNull(injector.getExistingBinding(Key.get(String.class)));
}
use of org.eclipse.xtext.ui.shared.internal.SharedStateContributionRegistryImpl in project xtext-eclipse by eclipse.
the class SharedStateContributionRegistryImplTest method testCreateContribution.
@Test
public void testCreateContribution() {
SharedStateContributionRegistryImpl registry = new SharedStateContributionRegistryImpl(injector);
SharedStateContribution contribution = registry.createContribution(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(CharSequenceClient.class).to(CharSequenceClientImpl.class);
}
});
Assert.assertTrue(contribution.isContributionSupported(CharSequenceClient.class));
Assert.assertFalse(contribution.isContributionSupported(IXtextDocument.class));
Assert.assertEquals("fromParentInjector", contribution.getContribution(CharSequenceClient.class).getSeq());
}
Aggregations