@@ -68,49 +68,64 @@ public class YoutubeStreamExtractorDefaultTest {
6868 public static final String YOUTUBE_LICENCE = "YouTube licence" ;
6969
7070 public static class NotAvailable {
71- @ BeforeAll
72- public static void setUp () throws IOException {
73- YoutubeTestsUtils .ensureStateless ();
74- NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "notAvailable" ));
75- }
71+ private static final String RESOURCE_PATH =
72+ YoutubeStreamExtractorDefaultTest .RESOURCE_PATH + "notAvailable/" ;
7673
7774 @ Test
7875 void geoRestrictedContent () throws Exception {
76+ YoutubeTestsUtils .ensureStateless ();
77+ NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "restricted" ));
78+
7979 final StreamExtractor extractor =
8080 YouTube .getStreamExtractor (BASE_URL + "_PL2HJKxnOM" );
8181 assertThrows (GeographicRestrictionException .class , extractor ::fetchPage );
8282 }
8383
8484 @ Test
8585 void nonExistentFetch () throws Exception {
86+ YoutubeTestsUtils .ensureStateless ();
87+ NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "nonExistent" ));
88+
8689 final StreamExtractor extractor =
8790 YouTube .getStreamExtractor (BASE_URL + "don-t-exist" );
8891 assertThrows (ContentNotAvailableException .class , extractor ::fetchPage );
8992 }
9093
9194 @ Test
9295 void invalidId () throws Exception {
96+ YoutubeTestsUtils .ensureStateless ();
97+ NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "invalidId" ));
98+
9399 final StreamExtractor extractor =
94100 YouTube .getStreamExtractor (BASE_URL + "INVALID_ID_INVALID_ID" );
95101 assertThrows (ParsingException .class , extractor ::fetchPage );
96102 }
97103
98104 @ Test
99105 void paidContent () throws Exception {
106+ YoutubeTestsUtils .ensureStateless ();
107+ NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "paidContent" ));
108+
100109 final StreamExtractor extractor =
101110 YouTube .getStreamExtractor (BASE_URL + "ayI2iBwGdxw" );
102111 assertThrows (PaidContentException .class , extractor ::fetchPage );
103112 }
104113
105114 @ Test
106115 void privateContent () throws Exception {
116+ YoutubeTestsUtils .ensureStateless ();
117+ NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "privateContent" ));
118+
107119 final StreamExtractor extractor =
108120 YouTube .getStreamExtractor (BASE_URL + "8VajtrESJzA" );
109121 assertThrows (PrivateContentException .class , extractor ::fetchPage );
110122 }
111123
112124 @ Test
113125 void youtubeMusicPremiumContent () throws Exception {
126+ YoutubeTestsUtils .ensureStateless ();
127+ NewPipe .init (DownloaderFactory .getDownloader (RESOURCE_PATH + "musicPremiumContent" ));
128+
114129 final StreamExtractor extractor =
115130 YouTube .getStreamExtractor (BASE_URL + "sMJ8bRN2dak" );
116131 assertThrows (YoutubeMusicPremiumContentException .class , extractor ::fetchPage );
0 commit comments