Content assist test with import [message #1810664] |
Thu, 15 August 2019 09:25  |
Eclipse User |
|
|
|
Hello,
I'm trying to create a content assist test but the test does not take into account the imported files. I found that xtext is loading both resources but not doing the linking, and thus my autocomplete (which depends on the linking) fails. How can I force the linking of the resources in the test. Below is the failing test. Any ideas of what can be wrong?
@RunWith(XtextRunner)
@InjectWith(MappingUiInjectorProvider)
class PathContentAssistTest extends AbstractContentAssistTest {
@Inject
ResourceSetManager resourceSetManager
protected var ResourceSet testModel
val mapModel = ''' my model (..) '''
@Test
def void testComplete() {
val model = '''
SimpleMapping 1.0.0
import "MAP.model"
VirtualMappingWithAggregationTest for input @MAP.OtherOutputEntity
output @MAP.VirtualModelOutputEntity
with @MAP.OtherOutputEntity as myInput {
outputBoolean = myInput.otherBoolean.outputBoolean
}'''
newBuilder()
.append(model)
.assertTextAtCursorPosition(model.indexOf("otherBoolean"), "\"Column\"", "\"otherBoolean\"", "\"otherDate\"")
}
def addResource(XtextResourceSet set, String modelName, String modelContent) {
val inputStream = new StringInputStream(modelContent)
val resource = set.createResource(URI::createURI(modelName))
resource.load(inputStream, null)
}
override protected initializeTypeProvider(XtextResourceSet set) {
addResource(set, "test.model", mapModel)
super.initializeTypeProvider(set)
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03869 seconds