void () { final Int2ObjectMap<IntArraySet> fileIdToNameId = generateEnoughMappings(ENOUGH_MAPPINGS); //add mappings one-by-one, and check each mapping is _absent_ in index before // it is added, and _present_ in the index just after it has been added: for (Map.Entry<Integer, IntArraySet> entry : fileIdToNameId.int2ObjectEntrySet()) { final int fileId = entry.getKey(); final IntArraySet nameIds = entry.getValue(); for (int nameId : nameIds) { assertFalse( "It should be no fileId(" + fileId + ")->nameId(" + nameId + ") mapping yet", fileIdsByNameId(nameId).contains(fileId)); invertedNameIndex.updateFileName(fileId, nameId, NULL_NAME_ID); assertTrue( "It should be fileId(" + fileId + ")->nameId(" + nameId + ") mapping now", fileIdsByNameId(nameId).contains(fileId)); } } //Now _remove_ mappings one-by-one, and check each mapping is _present_ in index before // it is removed, and _absent_ in the index just after it has been removed: for (Map.Entry<Integer, IntArraySet> entry : fileIdToNameId.int2ObjectEntrySet()) { final int fileId = entry.getKey(); final IntArraySet nameIds = entry.getValue(); for (int nameId : nameIds) { assertTrue( "It should be fileId(" + fileId + ")->nameId(" + nameId + ") mapping in the index", fileIdsByNameId(nameId).contains(fileId)); //remove mapping (map fileId -> NULL instead of nameId) invertedNameIndex.updateFileName(fileId, NULL_NAME_ID, nameId); assertFalse( "It should be NO fileId(" + fileId + ")->nameId(" + nameId + ") mapping in the index anymore", fileIdsByNameId(nameId).contains(fileId)); } } }