11package org .schabi .newpipe .extractor .services .youtube ;
22
3+ import java .io .File ;
4+ import java .io .IOException ;
35import java .util .Collections ;
46import java .util .HashSet ;
57import java .util .Map ;
1012import org .junit .runner .RunWith ;
1113import org .junit .runners .Suite ;
1214import org .junit .runners .Suite .SuiteClasses ;
13- import org .schabi .newpipe .DownloaderTestImpl ;
15+ import org .schabi .newpipe .downloader . DownloaderFactory ;
1416import org .schabi .newpipe .extractor .ListExtractor ;
1517import org .schabi .newpipe .extractor .ListExtractor .InfoItemsPage ;
1618import org .schabi .newpipe .extractor .NewPipe ;
@@ -41,6 +43,7 @@ public class YoutubeMixPlaylistExtractorTest {
4143 private static final String VIDEO_ID = "_AzeUSL9lZc" ;
4244 private static final String VIDEO_TITLE =
4345 "Most Beautiful And Emotional Piano: Anime Music Shigatsu wa Kimi no Uso OST IMO" ;
46+ private static final String RESOURCE_PATH = "src/test/resources/org/schabi/newpipe/extractor/services/youtube/mix/" ;
4447 private static final Map <String , String > dummyCookie
4548 = Collections .singletonMap (YoutubeMixPlaylistExtractor .COOKIE_NAME , "whatever" );
4649
@@ -50,7 +53,8 @@ public static class Mix {
5053
5154 @ BeforeClass
5255 public static void setUp () throws Exception {
53- NewPipe .init (DownloaderTestImpl .getInstance ());
56+ final File file = new File (RESOURCE_PATH + "mix" );
57+ NewPipe .init (new DownloaderFactory ().getDownloader (file .getAbsolutePath ()));
5458 extractor = (YoutubeMixPlaylistExtractor ) YouTube
5559 .getPlaylistExtractor (
5660 "https://www.youtube.com/watch?v=" + VIDEO_ID + "&list=RD" + VIDEO_ID );
@@ -127,7 +131,8 @@ public static class MixWithIndex {
127131
128132 @ BeforeClass
129133 public static void setUp () throws Exception {
130- NewPipe .init (DownloaderTestImpl .getInstance ());
134+ final File file = new File (RESOURCE_PATH + "mixWithIndex" );
135+ NewPipe .init (new DownloaderFactory ().getDownloader (file .getAbsolutePath ()));
131136 extractor = (YoutubeMixPlaylistExtractor ) YouTube
132137 .getPlaylistExtractor (
133138 "https://www.youtube.com/watch?v=" + VIDEO_ID_NUMBER_13 + "&list=RD"
@@ -196,7 +201,8 @@ public static class MyMix {
196201
197202 @ BeforeClass
198203 public static void setUp () throws Exception {
199- NewPipe .init (DownloaderTestImpl .getInstance ());
204+ final File file = new File (RESOURCE_PATH + "myMix" );
205+ NewPipe .init (new DownloaderFactory ().getDownloader (file .getAbsolutePath ()));
200206 extractor = (YoutubeMixPlaylistExtractor ) YouTube
201207 .getPlaylistExtractor (
202208 "https://www.youtube.com/watch?v=" + VIDEO_ID + "&list=RDMM"
@@ -267,8 +273,9 @@ public void getStreamCount() {
267273 public static class Invalid {
268274
269275 @ BeforeClass
270- public static void setUp () {
271- NewPipe .init (DownloaderTestImpl .getInstance ());
276+ public static void setUp () throws IOException {
277+ final File file = new File (RESOURCE_PATH + "invalid" );
278+ NewPipe .init (new DownloaderFactory ().getDownloader (file .getAbsolutePath ()));
272279 }
273280
274281 @ Test (expected = IllegalArgumentException .class )
@@ -299,7 +306,8 @@ public static class ChannelMix {
299306
300307 @ BeforeClass
301308 public static void setUp () throws Exception {
302- NewPipe .init (DownloaderTestImpl .getInstance ());
309+ final File file = new File (RESOURCE_PATH + "channelMix" );
310+ NewPipe .init (new DownloaderFactory ().getDownloader (file .getAbsolutePath ()));
303311 extractor = (YoutubeMixPlaylistExtractor ) YouTube
304312 .getPlaylistExtractor (
305313 "https://www.youtube.com/watch?v=" + VIDEO_ID_OF_CHANNEL
0 commit comments