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);
}
}
Aggregations