Skip to content

Commit

Permalink
simplified custom injector providers in xbase.tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed May 21, 2024
1 parent 4d0a037 commit f061b74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.eclipse.xtext.testing.util.ParseHelper;
import org.eclipse.xtext.testing.validation.ValidationTestHelper;
import org.eclipse.xtext.xbase.XExpression;
import org.eclipse.xtext.xbase.testlanguages.ContentAssistFragmentTestLangRuntimeModule;
import org.eclipse.xtext.xbase.testlanguages.contentAssistFragmentTestLang.ContentAssistFragmentTestLanguageRoot;
import org.eclipse.xtext.xbase.testlanguages.tests.ContentAssistFragmentTestLangInjectorProvider;
import org.junit.Assert;
Expand All @@ -32,16 +31,8 @@ public class ExtendedXbaseResourceDescriptionStrategyTest extends AbstractXbaseI
@Inject
private ValidationTestHelper validationHelper;

// inheritance allows for bindClassLoaderToInstance to get the class loader of this bundle
public static class ContentAssistFragmentTestLangInjectorProviderCustom extends ContentAssistFragmentTestLangInjectorProvider {
@Override
protected ContentAssistFragmentTestLangRuntimeModule createRuntimeModule() {
// make it work also with Maven/Tycho and OSGI
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672
// to access the testdata.stubs.StubbedList in this bundle
// allows for bindClassLoaderToInstance to get the class loader of this bundle
return new ContentAssistFragmentTestLangRuntimeModule() {
};
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.eclipse.xtext.testing.util.ParseHelper;
import org.eclipse.xtext.testing.validation.ValidationTestHelper;
import org.eclipse.xtext.xbase.XExpression;
import org.eclipse.xtext.xbase.testlanguages.XImportSectionTestLangRuntimeModule;
import org.eclipse.xtext.xbase.testlanguages.tests.XImportSectionTestLangInjectorProvider;
import org.eclipse.xtext.xbase.testlanguages.xImportSectionTestLang.ImportSectionTestLanguageRoot;
import org.junit.Assert;
Expand All @@ -31,16 +30,8 @@ public class XImportSectionResourceDescriptionStrategyTest extends AbstractXbase
@Inject
private ValidationTestHelper validationHelper;

// inheritance allows for bindClassLoaderToInstance to get the class loader of this bundle
public static class XImportSectionTestLangInjectorProviderCustom extends XImportSectionTestLangInjectorProvider {
@Override
protected XImportSectionTestLangRuntimeModule createRuntimeModule() {
// make it work also with Maven/Tycho and OSGI
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672
// to access the testdata.stubs.StubbedList in this bundle
// allows for bindClassLoaderToInstance to get the class loader of this bundle
return new XImportSectionTestLangRuntimeModule() {
};
}
}

@Override
Expand Down

0 comments on commit f061b74

Please sign in to comment.