use of org.eclipse.xtext.builder.builderState.impl.ResourceDescriptionImpl in project xtext-eclipse by eclipse.
the class EObjectDescriptionImplTest method testContainerAndFragmentChange.
@Test
public void testContainerAndFragmentChange() {
EObjectDescriptionImpl objectDescription = (EObjectDescriptionImpl) BuilderStateFactory.eINSTANCE.createEObjectDescription();
objectDescription.setFragment("myFragment");
ResourceDescriptionImpl resourceDescription = (ResourceDescriptionImpl) BuilderStateFactory.eINSTANCE.createResourceDescription();
resourceDescription.getExportedObjects().add(objectDescription);
resourceDescription.setURI(URI.createURI("some.uri"));
assertEquals(URI.createURI("some.uri#myFragment"), objectDescription.getEObjectURI());
resourceDescription.setURI(URI.createURI("some2.uri"));
assertEquals(URI.createURI("some2.uri#myFragment"), objectDescription.getEObjectURI());
objectDescription.setFragment("newFragment");
assertEquals(URI.createURI("some2.uri#newFragment"), objectDescription.getEObjectURI());
}
use of org.eclipse.xtext.builder.builderState.impl.ResourceDescriptionImpl in project xtext-eclipse by eclipse.
the class EObjectDescriptionImplTest method testNoNPE.
@Test
public void testNoNPE() {
EObjectDescriptionImpl objectDescription = (EObjectDescriptionImpl) BuilderStateFactory.eINSTANCE.createEObjectDescription();
objectDescription.setFragment("myFragment");
ResourceDescriptionImpl resourceDescription = (ResourceDescriptionImpl) BuilderStateFactory.eINSTANCE.createResourceDescription();
resourceDescription.getExportedObjects().add(objectDescription);
resourceDescription.setURI(URI.createURI("does.not.matter"));
EClass doesNotExist = EcoreFactory.eINSTANCE.createEClass();
InternalEObject proxy = (InternalEObject) doesNotExist;
proxy.eSetProxyURI(URI.createURI("does.not.exist"));
objectDescription.setEClass(doesNotExist);
assertSame(doesNotExist, objectDescription.getEClass());
assertNull(objectDescription.getEObjectOrProxy());
assertEquals("does.not.matter#myFragment", objectDescription.getEObjectURI().toString());
}
Aggregations