Source:
public void testUncontrolElementCausesEmptyFragment() throws IOException, CoreException, URISyntaxException { IComparisonScope scope = initComparison("emptyfragmentaftermerge"); Comparison comparison = EMFCompare.builder().build().compare(scope); BatchMerger batchMerger = new BatchMerger(EMFCompareRCPPlugin.getDefault().getMergerRegistry()); ResourceSet leftResourceSet = (ResourceSet)scope.getLeft(); ResourceSet rightResourceSet = (ResourceSet)scope.getRight(); ResourceSet originResourceSet = (ResourceSet)scope.getOrigin(); EcoreUtil.resolveAll(leftResourceSet); EcoreUtil.resolveAll(rightResourceSet); EcoreUtil.resolveAll(originResourceSet); assertEquals(1, leftResourceSet.getResources().size()); assertEquals(2, rightResourceSet.getResources().size()); assertEquals(rightResourceSet.getResources().get(0).getURI().lastSegment(), "right.nodes"); assertEquals(rightResourceSet.getResources().get(1).getURI().lastSegment(), "fragment.nodes"); assertEquals(2, originResourceSet.getResources().size()); batchMerger.copyAllLeftToRight(comparison.getDifferences(), null); ResourceUtil.saveAllResources(leftResourceSet, Collections.emptyMap()); ResourceUtil.saveAllResources(rightResourceSet, Collections.emptyMap()); ResourceUtil.saveAllResources(originResourceSet, Collections.emptyMap()); assertEquals(1, leftResourceSet.getResources().size()); assertEquals(1, rightResourceSet.getResources().size()); assertEquals(rightResourceSet.getResources().get(0).getURI().lastSegment(), "right.nodes"); assertEquals(2, originResourceSet.getResources().size()); IResource fragmentFile = ResourcesPlugin.getWorkspace().getRoot() .findMember("Project-1/right/fragment.nodes"); assertNull(fragmentFile); }

Target:
public void testUncontrolElementCausesEmptyFragment() throws IOException, CoreException, URISyntaxException { IComparisonScope scope = initComparison("_497566/empty"); Comparison comparison = EMFCompare.builder().build().compare(scope); BatchMerger batchMerger = new BatchMerger(EMFCompareRCPPlugin.getDefault().getMergerRegistry()); ResourceSet leftResourceSet = (ResourceSet)scope.getLeft(); ResourceSet rightResourceSet = (ResourceSet)scope.getRight(); ResourceSet originResourceSet = (ResourceSet)scope.getOrigin(); EcoreUtil.resolveAll(leftResourceSet); EcoreUtil.resolveAll(rightResourceSet); EcoreUtil.resolveAll(originResourceSet); assertEquals(1, leftResourceSet.getResources().size()); assertEquals(2, rightResourceSet.getResources().size()); assertEquals(rightResourceSet.getResources().get(0).getURI().lastSegment(), "right.nodes"); assertEquals(rightResourceSet.getResources().get(1).getURI().lastSegment(), "fragment.nodes"); assertEquals(2, originResourceSet.getResources().size()); batchMerger.copyAllLeftToRight(comparison.getDifferences(), null); ResourceUtil.saveAllResources(leftResourceSet, Collections.emptyMap()); ResourceUtil.saveAllResources(rightResourceSet, Collections.emptyMap()); ResourceUtil.saveAllResources(originResourceSet, Collections.emptyMap()); assertEquals(1, leftResourceSet.getResources().size()); assertEquals(1, rightResourceSet.getResources().size()); assertEquals(rightResourceSet.getResources().get(0).getURI().lastSegment(), "right.nodes"); assertEquals(2, originResourceSet.getResources().size()); IResource fragmentFile = ResourcesPlugin.getWorkspace().getRoot() .findMember("Project-1/right/fragment.nodes"); assertNull(fragmentFile); }