use of org.eclipse.xtext.resource.DefaultFragmentProvider in project xtext-core by eclipse.
the class TokenSerializerTest method testConstructedCrossReferenceWithProxy.
@Test
public void testConstructedCrossReferenceWithProxy() {
final XtextResourceSet resourceSet = this.resourceSetProvider.get();
Resource _createResource = resourceSet.createResource(this.getFileURI("dummy"));
final XtextResource resource = ((XtextResource) _createResource);
Model _createModel = this.factory.createModel();
final Procedure1<Model> _function = (Model it) -> {
SingleCrossReference _createSingleCrossReference = this.factory.createSingleCrossReference();
final Procedure1<SingleCrossReference> _function_1 = (SingleCrossReference it_1) -> {
it_1.setName("myref");
};
SingleCrossReference _doubleArrow = ObjectExtensions.<SingleCrossReference>operator_doubleArrow(_createSingleCrossReference, _function_1);
it.setX5(_doubleArrow);
};
final Model model = ObjectExtensions.<Model>operator_doubleArrow(_createModel, _function);
EList<EObject> _contents = resource.getContents();
_contents.add(model);
SingleCrossReference _x5 = model.getX5();
SingleCrossReference _createSingleCrossReference = this.factory.createSingleCrossReference();
final Procedure1<SingleCrossReference> _function_1 = (SingleCrossReference it) -> {
((InternalEObject) it).eSetProxyURI(resource.getURI().appendFragment("foo"));
};
SingleCrossReference _doubleArrow = ObjectExtensions.<SingleCrossReference>operator_doubleArrow(_createSingleCrossReference, _function_1);
_x5.setRef3(_doubleArrow);
resource.setFragmentProvider(new DefaultFragmentProvider() {
@Override
public EObject getEObject(final Resource resource, final String fragment, final IFragmentProvider.Fallback fallback) {
EObject _xifexpression = null;
boolean _equals = Objects.equal(fragment, "foo");
if (_equals) {
_xifexpression = model.getX5();
} else {
_xifexpression = super.getEObject(resource, fragment, fallback);
}
return _xifexpression;
}
});
StringConcatenation _builder = new StringConcatenation();
_builder.append("#5 myref kw3 myref");
_builder.newLine();
this.assertSerializesTo(model, _builder);
}
Aggregations