use of org.yakindu.sct.test.models.SCTUnitTestModels in project statecharts by Yakindu.
the class SCTResourceTest method testFragments.
@Test
public void testFragments() throws Exception {
SCTUnitTestModels models = new SCTUnitTestModels();
List<Statechart> originalStatecharts = models.loadAllStatecharts();
List<Statechart> targetStatecharts = models.loadAllStatecharts();
for (int i = 0; i < originalStatecharts.size(); i++) {
Statechart statechart = originalStatecharts.get(i);
Statechart targetStatechart = targetStatecharts.get(i);
Resource targetResource = targetStatechart.eResource();
assertTrue(statechart != targetStatechart);
assertTrue(EcoreUtil.equals(statechart, targetStatechart));
TreeIterator<EObject> allContents = EcoreUtil.getAllContents(statechart.eResource(), true);
while (allContents.hasNext()) {
EObject next = allContents.next();
String fragment = EcoreUtil.getURI(next).fragment();
EObject targetObject = targetResource.getEObject(fragment);
assertNotNull("Could not resolve fragment " + fragment + " for EObject " + next + "in statechart " + statechart.getName(), targetObject);
assertTrue(EcoreUtil.equals(next, targetObject));
}
}
}
Aggregations