Search in sources :

Example 1 with AssetsDocumentFile

use of androidx.documentfile.provider.AssetsDocumentFile in project AntennaPod by AntennaPod.

the class LocalFeedUpdaterTest method callUpdateFeed.

/**
 * Calls the method {@link LocalFeedUpdater#updateFeed(Feed, Context)} with
 * the given local feed folder.
 *
 * @param localFeedDir assets local feed folder with media files
 */
private void callUpdateFeed(@NonNull String localFeedDir) {
    DocumentFile documentFile = new AssetsDocumentFile(localFeedDir, context.getAssets());
    try (MockedStatic<DocumentFile> dfMock = Mockito.mockStatic(DocumentFile.class)) {
        // mock external storage
        dfMock.when(() -> DocumentFile.fromTreeUri(any(), any())).thenReturn(documentFile);
        // call method to test
        Feed feed = new Feed(FEED_URL, null);
        LocalFeedUpdater.updateFeed(feed, context);
    }
}
Also used : DocumentFile(androidx.documentfile.provider.DocumentFile) AssetsDocumentFile(androidx.documentfile.provider.AssetsDocumentFile) AssetsDocumentFile(androidx.documentfile.provider.AssetsDocumentFile) Feed(de.danoeh.antennapod.model.feed.Feed)

Aggregations

AssetsDocumentFile (androidx.documentfile.provider.AssetsDocumentFile)1 DocumentFile (androidx.documentfile.provider.DocumentFile)1 Feed (de.danoeh.antennapod.model.feed.Feed)1