@Test public void getDownload_nonExistingId_returnsNull() throws DatabaseIOException { assertThat(downloadIndex.getDownload("non existing id")).isNull(); }
@Override @Nullable public Download getDownload(String id) throws DatabaseIOException { ensureInitialized(); try (Cursor cursor = getCursor(WHERE_ID_EQUALS, new String[] {id})) { if (cursor.getCount() == 0) { return null; } cursor.moveToNext(); return getDownloadForCurrentRow(cursor); } catch (SQLiteException e) { throw new DatabaseIOException(e); } }
DefaultDownloadIndex implements WritableDownloadIndex { @Override @Nullable public Download getDownload(String id) throws DatabaseIOException { ensureInitialized(); try (Cursor cursor = getCursor(WHERE_ID_EQUALS, new String[] {id})) { if (cursor.getCount() == 0) { return null; } cursor.moveToNext(); return getDownloadForCurrentRow(cursor); } catch (SQLiteException e) { throw new DatabaseIOException(e); } } }
DefaultDownloadIndex implements WritableDownloadIndex { @Override @Nullable public Download getDownload(String id) throws DatabaseIOException { ensureInitialized(); try (Cursor cursor = getCursor(WHERE_ID_EQUALS, new String[] {id})) { if (cursor.getCount() == 0) { return null; } cursor.moveToNext(); return getDownloadForCurrentRow(cursor); } catch (SQLiteException e) { throw new DatabaseIOException(e); } } DefaultDownloadIndex(DatabaseProvider databaseProvider);  DefaultDownloadIndex(DatabaseProvider databaseProvider, String name); }
DefaultDownloadIndex implements WritableDownloadIndex { @Override @Nullable public Download getDownload(String id) throws DatabaseIOException { ensureInitialized(); try (Cursor cursor = getCursor(WHERE_ID_EQUALS, new String[] {id})) { if (cursor.getCount() == 0) { return null; } cursor.moveToNext(); return getDownloadForCurrentRow(cursor); } catch (SQLiteException e) { throw new DatabaseIOException(e); } } DefaultDownloadIndex(DatabaseProvider databaseProvider);  DefaultDownloadIndex(DatabaseProvider databaseProvider, String name); @Override @Nullable Download getDownload(String id); @Override DownloadCursor getDownloads(@Download.State int... states); @Override void putDownload(Download download); @Override void removeDownload(String id); @Override void setDownloadingStatesToQueued(); @Override void setStopReason(int stopReason); @Override void setStopReason(String id, int stopReason); }
DefaultDownloadIndex implements WritableDownloadIndex { @Override @Nullable public Download getDownload(String id) throws DatabaseIOException { ensureInitialized(); try (Cursor cursor = getCursor(WHERE_ID_EQUALS, new String[] {id})) { if (cursor.getCount() == 0) { return null; } cursor.moveToNext(); return getDownloadForCurrentRow(cursor); } catch (SQLiteException e) { throw new DatabaseIOException(e); } } DefaultDownloadIndex(DatabaseProvider databaseProvider);  DefaultDownloadIndex(DatabaseProvider databaseProvider, String name); @Override @Nullable Download getDownload(String id); @Override DownloadCursor getDownloads(@Download.State int... states); @Override void putDownload(Download download); @Override void removeDownload(String id); @Override void setDownloadingStatesToQueued(); @Override void setStopReason(int stopReason); @Override void setStopReason(String id, int stopReason);  }