ResourceMerger extends DataMerger<ResourceItem, ResourceFile, ResourceSet> { @Override public void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp) throws MergingException { clearFilterCache(); super.mergeData(consumer, doCleanUp); } ResourceMerger(int minSdk); @Override void addDataSet(ResourceSet resourceSet); @Override void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp);  }
@Test public void testUpdateWithBasicFiles() throws Exception { File root = getIncMergeRoot("basicFiles"); File fakeRoot = getMergedBlobFolder(root); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(2, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet mainSet = sets.get(0); File mainBase = new File(root, "main"); File mainDrawable = new File(mainBase, "drawable"); File mainDrawableLdpi = new File(mainBase, "drawable-ldpi"); File mainDrawableTouched = new File(mainDrawable, "touched.png"); mainSet.updateWith(mainBase, mainDrawableTouched, FileStatus.CHANGED, logger); checkLogger(logger); File mainDrawableRemoved = new File(mainDrawable, "removed.png"); mainSet.updateWith(mainBase, mainDrawableRemoved, FileStatus.REMOVED, logger); checkLogger(logger); File mainDrawableLdpiRemoved = new File(mainDrawableLdpi, "removed.png"); mainSet.updateWith(mainBase, mainDrawableLdpiRemoved, FileStatus.REMOVED, logger); checkLogger(logger); ResourceSet overlaySet = sets.get(1); File overlayBase = new File(root, "overlay"); File overlayDrawable = new File(overlayBase, "drawable"); File overlayDrawableHdpi = new File(overlayBase, "drawable-hdpi"); File overlayDrawableNewOverlay = new File(overlayDrawable, "new_overlay.png"); overlaySet.updateWith(overlayBase, overlayDrawableNewOverlay, FileStatus.NEW, logger); checkLogger(logger); File overlayDrawableRemovedOverlay = new File(overlayDrawable, "removed_overlay.png"); overlaySet.updateWith(overlayBase, overlayDrawableRemovedOverlay, FileStatus.REMOVED, logger); checkLogger(logger); File overlayDrawableHdpiNewAlternate = new File(overlayDrawableHdpi, "new_alternate.png"); overlaySet.updateWith(overlayBase, overlayDrawableHdpiNewAlternate, FileStatus.NEW, logger); checkLogger(logger); resourceMerger.validateDataSets(); ListMultimap<String, ResourceItem> mergedMap = resourceMerger.getDataMap(); List<ResourceItem> drawableUntouched = mergedMap.get("drawable/untouched"); assertEquals(1, drawableUntouched.size()); assertTrue(drawableUntouched.get(0).isWritten()); assertFalse(drawableUntouched.get(0).isTouched()); assertFalse(drawableUntouched.get(0).isRemoved()); List<ResourceItem> drawableTouched = mergedMap.get("drawable/touched"); assertEquals(1, drawableTouched.size()); assertTrue(drawableTouched.get(0).isWritten()); assertTrue(drawableTouched.get(0).isTouched()); assertFalse(drawableTouched.get(0).isRemoved()); List<ResourceItem> drawableRemoved = mergedMap.get("drawable/removed"); assertEquals(1, drawableRemoved.size()); assertTrue(drawableRemoved.get(0).isWritten()); assertTrue(drawableRemoved.get(0).isRemoved()); List<ResourceItem> drawableNewOverlay = mergedMap.get("drawable/new_overlay"); assertEquals(2, drawableNewOverlay.size()); ResourceItem newOverlay = drawableNewOverlay.get(1); assertEquals(overlayDrawableNewOverlay, newOverlay.getSource().getFile()); assertFalse(newOverlay.isWritten()); assertTrue(newOverlay.isTouched()); List<ResourceItem> drawableHdpiNewAlternate = mergedMap.get("drawable-hdpi-v4/new_alternate"); assertEquals(1, drawableHdpiNewAlternate.size()); ResourceItem newAlternate = drawableHdpiNewAlternate.get(0); assertEquals(overlayDrawableHdpiNewAlternate, newAlternate.getSource().getFile()); assertFalse(newAlternate.isWritten()); assertTrue(newAlternate.isTouched()); File resFolder = getFolderCopy(new File(root, "resOut")); resFolder.deleteOnExit(); File mergeLogFolder = TestUtils.createTempDirDeletedOnExit(); mergeLogFolder.deleteOnExit(); MergedResourceWriter writer = MergedResourceWriter.createWriterWithoutPngCruncher( resFolder, null , mergeLogFolder, mPreprocessor, mTemporaryFolder.getRoot()); resourceMerger.mergeData(writer, false ); checkImageColor(new File(resFolder, "drawable" + File.separator + "touched.png"), (int) 0xFF00FF00); checkImageColor(new File(resFolder, "drawable" + File.separator + "untouched.png"), (int) 0xFF00FF00); checkImageColor(new File(resFolder, "drawable" + File.separator + "new_overlay.png"), (int) 0xFF00FF00); checkImageColor(new File(resFolder, "drawable" + File.separator + "removed_overlay.png"), (int) 0xFF00FF00); checkImageColor(new File(resFolder, "drawable-hdpi-v4" + File.separator + "new_alternate.png"), (int) 0xFF00FF00); assertFalse(new File(resFolder, "drawable-ldpi-v4" + File.separator + "removed.png").isFile()); MergingLog mergingLog = new MergingLog(mergeLogFolder); SourceFile original = mergingLog.find( new SourceFile(new File(resFolder, "drawable" + File.separator + "touched.png"))); assertTrue(original.getSourceFile().getAbsolutePath().endsWith( "basicFiles/main/drawable/touched.png".replace('/', File.separatorChar))); }
@Test public void testUpdateWithBasicValues() throws Exception { File root = getIncMergeRoot("basicValues"); File fakeRoot = getMergedBlobFolder(root); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(2, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet mainSet = sets.get(0); File mainBase = new File(root, "main"); File mainValues = new File(mainBase, "values"); File mainValuesEn = new File(mainBase, "values-en"); File mainValuesTouched = new File(mainValues, "values.xml"); mainSet.updateWith(mainBase, mainValuesTouched, FileStatus.CHANGED, logger); checkLogger(logger); File mainValuesEnRemoved = new File(mainValuesEn, "values.xml"); mainSet.updateWith(mainBase, mainValuesEnRemoved, FileStatus.REMOVED, logger); checkLogger(logger); ResourceSet overlaySet = sets.get(1); File overlayBase = new File(root, "overlay"); File overlayValues = new File(overlayBase, "values"); File overlayValuesFr = new File(overlayBase, "values-fr"); File overlayValuesNew = new File(overlayValues, "values.xml"); overlaySet.updateWith(overlayBase, overlayValuesNew, FileStatus.NEW, logger); checkLogger(logger); File overlayValuesFrNew = new File(overlayValuesFr, "values.xml"); overlaySet.updateWith(overlayBase, overlayValuesFrNew, FileStatus.NEW, logger); checkLogger(logger); resourceMerger.validateDataSets(); ListMultimap<String, ResourceItem> mergedMap = resourceMerger.getDataMap(); List<ResourceItem> valuesUntouched = mergedMap.get("string/untouched"); assertEquals(1, valuesUntouched.size()); assertTrue(valuesUntouched.get(0).isWritten()); assertFalse(valuesUntouched.get(0).isTouched()); assertFalse(valuesUntouched.get(0).isRemoved()); List<ResourceItem> valuesTouched = mergedMap.get("string/touched"); assertEquals(1, valuesTouched.size()); assertTrue(valuesTouched.get(0).isWritten()); assertTrue(valuesTouched.get(0).isTouched()); assertFalse(valuesTouched.get(0).isRemoved()); List<ResourceItem> valuesRemoved = mergedMap.get("string/removed"); assertEquals(1, valuesRemoved.size()); assertTrue(valuesRemoved.get(0).isWritten()); assertTrue(valuesRemoved.get(0).isRemoved()); valuesRemoved = mergedMap.get("string-en/removed"); assertEquals(1, valuesRemoved.size()); assertTrue(valuesRemoved.get(0).isWritten()); assertTrue(valuesRemoved.get(0).isRemoved()); List<ResourceItem> valuesNewOverlay = mergedMap.get("string/new_overlay"); assertEquals(2, valuesNewOverlay.size()); ResourceItem newOverlay = valuesNewOverlay.get(1); assertFalse(newOverlay.isWritten()); assertTrue(newOverlay.isTouched()); List<ResourceItem> valuesFrNewAlternate = mergedMap.get("string-fr/new_alternate"); assertEquals(1, valuesFrNewAlternate.size()); ResourceItem newAlternate = valuesFrNewAlternate.get(0); assertFalse(newAlternate.isWritten()); assertTrue(newAlternate.isTouched()); File resFolder = getFolderCopy(new File(root, "resOut")); File mergeLogFolder = TestUtils.createTempDirDeletedOnExit(); mergeLogFolder.deleteOnExit(); MergedResourceWriter writer = MergedResourceWriter.createWriterWithoutPngCruncher( resFolder, null , mergeLogFolder, mPreprocessor, mTemporaryFolder.getRoot()); resourceMerger.mergeData(writer, false ); Map<String, String> map = quickStringOnlyValueFileParser( new File(resFolder, "values" + File.separator + "values.xml")); assertEquals("untouched", map.get("untouched")); assertEquals("touched", map.get("touched")); assertEquals("new_overlay", map.get("new_overlay")); map = quickStringOnlyValueFileParser( new File(resFolder, "values-fr" + File.separator + "values-fr.xml")); assertEquals("new_alternate", map.get("new_alternate")); assertFalse(new File(resFolder, "values-en" + File.separator + "values-en.xml").isFile()); MergingLog mergingLog = new MergingLog(mergeLogFolder); SourceFile destFile = mergingLog.destinationFor( new SourceFile(overlayValuesNew)); SourceFilePosition original = mergingLog.find( new SourceFilePosition(destFile, new SourcePosition(2,5,-1))); assertEquals(new SourcePosition(2, 4, 55, 2, 51, 102), original.getPosition()); assertTrue(original.getFile().getSourceFile().getAbsolutePath().endsWith( "basicValues/overlay/values/values.xml".replace('/', File.separatorChar))); }
@Test public void testUpdateWithBasicValues2() throws Exception { File root = getIncMergeRoot("basicValues2"); File fakeRoot = getMergedBlobFolder(root); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(2, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet overlaySet = sets.get(1); File overlayBase = new File(root, "overlay"); File overlayValues = new File(overlayBase, "values"); File overlayValuesNew = new File(overlayValues, "values.xml"); overlaySet.updateWith(overlayBase, overlayValuesNew, FileStatus.REMOVED, logger); checkLogger(logger); resourceMerger.validateDataSets(); ListMultimap<String, ResourceItem> mergedMap = resourceMerger.getDataMap(); List<ResourceItem> valuesUntouched = mergedMap.get("string/untouched"); assertEquals(1, valuesUntouched.size()); assertTrue(valuesUntouched.get(0).isWritten()); assertFalse(valuesUntouched.get(0).isTouched()); assertFalse(valuesUntouched.get(0).isRemoved()); List<ResourceItem> valuesRemovedOverlay = mergedMap.get("string/removed_overlay"); assertEquals(2, valuesRemovedOverlay.size()); assertFalse(valuesRemovedOverlay.get(0).isWritten()); assertFalse(valuesRemovedOverlay.get(0).isTouched()); assertFalse(valuesRemovedOverlay.get(0).isRemoved()); assertTrue(valuesRemovedOverlay.get(1).isWritten()); assertFalse(valuesRemovedOverlay.get(1).isTouched()); assertTrue(valuesRemovedOverlay.get(1).isRemoved()); File resFolder = getFolderCopy(new File(root, "resOut")); MergedResourceWriter writer = getConsumer(resFolder); resourceMerger.mergeData(writer, false ); Map<String, String> map = quickStringOnlyValueFileParser( new File(resFolder, "values" + File.separator + "values.xml")); assertEquals("untouched", map.get("untouched")); assertEquals("untouched", map.get("removed_overlay")); }
@Test public void testUpdateWithFilesVsValues() throws Exception { File root = getIncMergeRoot("filesVsValues"); File fakeRoot = getMergedBlobFolder(root); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(1, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet mainSet = sets.get(0); File mainBase = new File(root, "main"); File mainValues = new File(mainBase, ResourceFolderType.VALUES.getName()); File mainLayout = new File(mainBase, ResourceFolderType.LAYOUT.getName()); File mainValuesTouched = new File(mainValues, "values.xml"); mainSet.updateWith(mainBase, mainValuesTouched, FileStatus.CHANGED, logger); checkLogger(logger); File mainLayoutNew = new File(mainLayout, "alias_replaced_by_file.xml"); mainSet.updateWith(mainBase, mainLayoutNew, FileStatus.NEW, logger); checkLogger(logger); File mainLayoutRemoved = new File(mainLayout, "file_replaced_by_alias.xml"); mainSet.updateWith(mainBase, mainLayoutRemoved, FileStatus.REMOVED, logger); checkLogger(logger); resourceMerger.validateDataSets(); ListMultimap<String, ResourceItem> mergedMap = resourceMerger.getDataMap(); List<ResourceItem> layoutMain = mergedMap.get("layout/main"); assertEquals(1, layoutMain.size()); assertTrue(layoutMain.get(0).isWritten()); assertFalse(layoutMain.get(0).isTouched()); assertFalse(layoutMain.get(0).isRemoved()); List<ResourceItem> layoutReplacedByAlias = mergedMap.get("layout/file_replaced_by_alias"); assertEquals(2, layoutReplacedByAlias.size()); ResourceItem replacedByAlias = layoutReplacedByAlias.get(0); assertTrue(replacedByAlias.isWritten()); assertFalse(replacedByAlias.isTouched()); assertTrue(replacedByAlias.isRemoved()); assertNull(replacedByAlias.getValue()); assertEquals("file_replaced_by_alias.xml", replacedByAlias.getSource().getFile().getName()); replacedByAlias = layoutReplacedByAlias.get(1); assertFalse(replacedByAlias.isWritten()); assertTrue(replacedByAlias.isTouched()); assertFalse(replacedByAlias.isRemoved()); assertNotNull(replacedByAlias.getValue()); assertEquals("values.xml", replacedByAlias.getSource().getFile().getName()); List<ResourceItem> layoutReplacedByFile = mergedMap.get("layout/alias_replaced_by_file"); assertEquals(2, layoutReplacedByFile.size()); ResourceItem replacedByFile = layoutReplacedByFile.get(0); assertTrue(replacedByFile.isWritten()); assertFalse(replacedByFile.isTouched()); assertTrue(replacedByFile.isRemoved()); assertNotNull(replacedByFile.getValue()); assertEquals("values.xml", replacedByFile.getSource().getFile().getName()); replacedByFile = layoutReplacedByFile.get(1); assertFalse(replacedByFile.isWritten()); assertTrue(replacedByFile.isTouched()); assertFalse(replacedByFile.isRemoved()); assertNull(replacedByFile.getValue()); assertEquals("alias_replaced_by_file.xml", replacedByFile.getSource().getFile().getName()); File resFolder = getFolderCopy(new File(root, "resOut")); MergedResourceWriter writer = getConsumer(resFolder); resourceMerger.mergeData(writer, false ); assertFalse(new File(resFolder, "layout" + File.separator + "file_replaced_by_alias.xml") .isFile()); assertTrue(new File(resFolder, "layout" + File.separator + "alias_replaced_by_file.xml") .isFile()); File valuesFile = new File(resFolder, "values" + File.separator + "values.xml"); assertTrue(valuesFile.isFile()); String content = Files.toString(valuesFile, Charsets.UTF_8); assertTrue(content.contains("name=\"file_replaced_by_alias\"")); assertFalse(content.contains("name=\"alias_replaced_by_file\"")); }
@Test public void testIncDataForRemovedFile() throws Exception { File root = TestUtils.getCanonicalRoot("resources", "removedFile"); File fakeBlobRoot = getMergedBlobFolder(root); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeBlobRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(1, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet mainSet = sets.get(0); File resBase = new File(root, "res"); File resDrawable = new File(resBase, ResourceFolderType.DRAWABLE.getName()); File resIconRemoved = new File(resDrawable, "removed.png"); mainSet.updateWith(resBase, resIconRemoved, FileStatus.REMOVED, logger); checkLogger(logger); resourceMerger.validateDataSets(); ListMultimap<String, ResourceItem> mergedMap = resourceMerger.getDataMap(); List<ResourceItem> removedIcon = mergedMap.get("drawable/removed"); assertEquals(1, removedIcon.size()); assertTrue(removedIcon.get(0).isRemoved()); assertTrue(removedIcon.get(0).isWritten()); assertFalse(removedIcon.get(0).isTouched()); File outFolder = getFolderCopy(new File(root, "out")); MergedResourceWriter writer = getConsumer(outFolder); resourceMerger.mergeData(writer, false ); File outDrawableFolder = new File(outFolder, ResourceFolderType.DRAWABLE.getName()); assertFalse(new File(outDrawableFolder, "removed.png").isFile()); assertTrue(new File(outDrawableFolder, "icon.png").isFile()); File outBlobFolder = TestUtils.createTempDirDeletedOnExit(); resourceMerger.writeBlobTo(outBlobFolder, writer, false); ResourceMerger resourceMerger2 = new ResourceMerger(0); assertTrue(resourceMerger2.loadFromBlob(outBlobFolder, true )); mergedMap = resourceMerger2.getDataMap(); removedIcon = mergedMap.get("drawable/removed"); assertTrue(removedIcon.isEmpty()); }
@Test public void testUnchangedMergedItem() throws Exception { File root = TestUtils.getRoot("resources", "declareStyleable"); File fakeBlobRoot = getMergedBlobFolder(root, new File(root, "unchanged_merger.xml")); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeBlobRoot, true )); checkSourceFolders(resourceMerger); FakeMergeConsumer consumer = new FakeMergeConsumer(); resourceMerger.mergeData(consumer, false ); assertTrue(consumer.touchedItems.isEmpty()); assertTrue(consumer.removedItems.isEmpty()); }
@Test public void testRemovedMergedItem() throws Exception { File root = TestUtils.getCanonicalRoot("resources", "declareStyleable"); File fakeBlobRoot = getMergedBlobFolder(root, new File(root, "removed_merger.xml")); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeBlobRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(2, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet mainSet = sets.get(0); File mainRoot = new File(root, "base"); File mainValues = new File(mainRoot, ResourceFolderType.VALUES.getName()); File touchedValueFile = new File(mainValues, "values.xml"); mainSet.updateWith(mainRoot, touchedValueFile, FileStatus.CHANGED, logger); checkLogger(logger); ResourceSet overlaySet = sets.get(1); File overlayRoot = new File(root, "overlay"); File overlayValues = new File(overlayRoot, ResourceFolderType.VALUES.getName()); touchedValueFile = new File(overlayValues, "values.xml"); overlaySet.updateWith(overlayRoot, touchedValueFile, FileStatus.CHANGED, logger); checkLogger(logger); FakeMergeConsumer consumer = new FakeMergeConsumer(); resourceMerger.mergeData(consumer, false ); assertTrue(consumer.touchedItems.isEmpty()); assertEquals(1, consumer.removedItems.size()); }
@Test public void testTouchedMergedItem() throws Exception { File root = TestUtils.getCanonicalRoot("resources", "declareStyleable"); File fakeBlobRoot = getMergedBlobFolder(root, new File(root, "touched_merger.xml")); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeBlobRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(2, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet mainSet = sets.get(0); File mainRoot = new File(root, "base"); File mainValues = new File(mainRoot, ResourceFolderType.VALUES.getName()); File touchedValueFile = new File(mainValues, "values.xml"); mainSet.updateWith(mainRoot, touchedValueFile, FileStatus.CHANGED, logger); checkLogger(logger); FakeMergeConsumer consumer = new FakeMergeConsumer(); resourceMerger.mergeData(consumer, false ); assertEquals(1, consumer.touchedItems.size()); assertTrue(consumer.removedItems.isEmpty()); }
@Test public void testTouchedNoDiffMergedItem() throws Exception { File root = TestUtils.getCanonicalRoot("resources", "declareStyleable"); File fakeBlobRoot = getMergedBlobFolder(root, new File(root, "touched_nodiff_merger.xml")); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeBlobRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(2, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet overlaySet = sets.get(1); File overlayRoot = new File(root, "overlay"); File overlayValues = new File(overlayRoot, ResourceFolderType.VALUES.getName()); File touchedValueFile = new File(overlayValues, "values.xml"); overlaySet.updateWith(overlayRoot, touchedValueFile, FileStatus.CHANGED, logger); checkLogger(logger); FakeMergeConsumer consumer = new FakeMergeConsumer(); resourceMerger.mergeData(consumer, false ); assertTrue(consumer.touchedItems.isEmpty()); assertTrue(consumer.removedItems.isEmpty()); }
@Test public void testRemovedOtherWithNoNoDiffTouchMergedItem() throws Exception { File root = TestUtils.getCanonicalRoot("resources", "declareStyleable"); File fakeBlobRoot = getMergedBlobFolder(root, new File(root, "removed_other_merger.xml")); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeBlobRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(2, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet mainSet = sets.get(0); File mainRoot = new File(root, "base"); File mainValues = new File(mainRoot, ResourceFolderType.VALUES.getName()); File touchedValueFile = new File(mainValues, "values.xml"); mainSet.updateWith(mainRoot, touchedValueFile, FileStatus.CHANGED, logger); checkLogger(logger); ResourceSet overlaySet = sets.get(1); File overlayRoot = new File(root, "overlay"); File overlayValues = new File(overlayRoot, ResourceFolderType.VALUES.getName()); touchedValueFile = new File(overlayValues, "values.xml"); overlaySet.updateWith(overlayRoot, touchedValueFile, FileStatus.CHANGED, logger); checkLogger(logger); FakeMergeConsumer consumer = new FakeMergeConsumer(); resourceMerger.mergeData(consumer, false ); assertEquals(3, consumer.addedItems.size()); assertTrue(consumer.touchedItems.isEmpty()); assertEquals(1, consumer.removedItems.size()); }