Search in sources :

Example 1 with FileDownloadDatabase

use of com.liulishuo.filedownloader.database.FileDownloadDatabase in project FileDownloader by lingochamp.

the class DownloadLaunchRunnableTest method getMockNonOptDatabaseMaker.

private static FileDownloadHelper.DatabaseCustomMaker getMockNonOptDatabaseMaker() {
    final FileDownloadDatabase database = mock(FileDownloadDatabase.class);
    when(database.maintainer()).thenReturn(new FileDownloadDatabase.Maintainer() {

        @Override
        public void onFinishMaintain() {
        }

        @Override
        public void onRemovedInvalidData(FileDownloadModel model) {
        }

        @Override
        public void onRefreshedValidData(FileDownloadModel model) {
        }

        @Override
        public void changeFileDownloadModelId(int oldId, FileDownloadModel modelWithNewId) {
        }

        @Override
        public Iterator<FileDownloadModel> iterator() {
            return new Iterator<FileDownloadModel>() {

                @Override
                public boolean hasNext() {
                    return false;
                }

                @Override
                public FileDownloadModel next() {
                    return null;
                }
            };
        }
    });
    return new FileDownloadHelper.DatabaseCustomMaker() {

        @Override
        public FileDownloadDatabase customMake() {
            return database;
        }
    };
}
Also used : FileDownloadDatabase(com.liulishuo.filedownloader.database.FileDownloadDatabase) FileDownloadModel(com.liulishuo.filedownloader.model.FileDownloadModel) Iterator(java.util.Iterator)

Aggregations

FileDownloadDatabase (com.liulishuo.filedownloader.database.FileDownloadDatabase)1 FileDownloadModel (com.liulishuo.filedownloader.model.FileDownloadModel)1 Iterator (java.util.Iterator)1