void () { final Int2ObjectMap<String> fileIdToName = generateFileNames(ENOUGH_ENTRIES_TO_CHECK); for (Int2ObjectMap.Entry<String> e : fileIdToName.int2ObjectEntrySet()) { final int fileId = e.getIntKey(); final String fileName = e.getValue(); index.addFileName(fileId, fileName); assertTrue( "Index must return fileId just added", lookupIndexByFileName(index, fileName).contains(fileId) ); } for (Int2ObjectMap.Entry<String> e : fileIdToName.int2ObjectEntrySet()) { final int fileId = e.getIntKey(); final String fileName = e.getValue(); index.removeFileName(fileId, fileName); assertFalse( "Index must NOT return fileId just removed", lookupIndexByFileName(index, fileName).contains(fileId) ); } for (String fileName : new HashSet<>(fileIdToName.values())) { final IntArraySet fileIdsFromIndex = lookupIndexByFileName(index, fileName); assertTrue( "Index must return NOTHING after all entries removed", fileIdsFromIndex.isEmpty() ); } }