TargetObject targetObject = ModelFactory.eINSTANCE.createTargetObject();
targetObject.setSingleAttribute("junit");
saveObject(resourceSet, targetObject);
PrimaryObject primaryObject = ModelFactory.eINSTANCE.createPrimaryObject();
primaryObject.setName("junit");
primaryObject.setSingleContainmentReferenceProxies(targetObject);
saveObject(resourceSet, primaryObject);
// Test : Delete the target object and reload the primary object
targetObject.eResource().delete(null);
ResourceSet testResourceSet = createResourceSet();
Resource resource = testResourceSet.getResource(primaryObject.eResource().getURI(), true);
// Verify : Check that the object was stored correctly.
assertThat(resource, is(notNullValue()));
assertThat(resource.getContents().size(), is(1));
PrimaryObject actual = (PrimaryObject) resource.getContents().get(0);
assertThat(actual.getSingleContainmentReferenceProxies(), is(notNullValue()));
assertTrue(actual.getSingleContainmentReferenceProxies().eIsProxy());
}