CacheFileMetadataIndex { @WorkerThread public Map<String, CacheFileMetadata> getAll() throws DatabaseIOException { try (Cursor cursor = getCursor()) { Map<String, CacheFileMetadata> fileMetadata = new HashMap<>(cursor.getCount()); while (cursor.moveToNext()) { String name = cursor.getString(COLUMN_INDEX_NAME); long length = cursor.getLong(COLUMN_INDEX_LENGTH); long lastTouchTimestamp = cursor.getLong(COLUMN_INDEX_LAST_TOUCH_TIMESTAMP); fileMetadata.put(name, new CacheFileMetadata(length, lastTouchTimestamp)); } return fileMetadata; } catch (SQLException e) { throw new DatabaseIOException(e); } } CacheFileMetadataIndex(DatabaseProvider databaseProvider); @WorkerThread static void delete(DatabaseProvider databaseProvider, long uid); @WorkerThread void initialize(long uid); @WorkerThread Map<String, CacheFileMetadata> getAll(); @WorkerThread void set(String name, long length, long lastTouchTimestamp); @WorkerThread void remove(String name); @WorkerThread void removeAll(Set<String> names);  }
@Test public void initiallyEmpty() throws DatabaseIOException { CacheFileMetadataIndex index = newInitializedIndex(); assertThat(index.getAll()).isEmpty(); }