### Question:
CachedContentIndex { @VisibleForTesting static int getNewId(SparseArray<String> idToKey) { int size = idToKey.size(); int id = size == 0 ? 0 : (idToKey.keyAt(size - 1) + 1); if (id < 0) { for (id = 0; id < size; id++) { if (id != idToKey.keyAt(id)) { break; } } } return id; } CachedContentIndex(DatabaseProvider databaseProvider);  CachedContentIndex(
      @Nullable DatabaseProvider databaseProvider,
      @Nullable File legacyStorageDir,
      @Nullable byte[] legacyStorageSecretKey,
      boolean legacyStorageEncrypt,
      boolean preferLegacyStorage); static final boolean isIndexFile(String fileName); static void delete(DatabaseProvider databaseProvider, long uid); void initialize(long uid); void store(); CachedContent getOrAdd(String key); CachedContent get(String key); Collection<CachedContent> getAll(); int assignIdForKey(String key); String getKeyForId(int id); void maybeRemove(String key); void removeEmpty(); Set<String> getKeys(); void applyContentMetadataMutations(String key, ContentMetadataMutations mutations); ContentMetadata getContentMetadata(String key);  }### Answer:
@Test public void testGetNewId() { SparseArray<String> idToKey = new SparseArray<>(); assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(0); idToKey.put(10, ""); assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(11); idToKey.put(Integer.MAX_VALUE, ""); assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(0); idToKey.put(0, ""); assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(1); }