22
33import static org .junit .jupiter .api .Assertions .assertEquals ;
44import static org .junit .jupiter .api .Assertions .assertFalse ;
5- import static org .junit .jupiter .api .Assertions .assertNull ;
65import static org .junit .jupiter .api .Assertions .assertThrows ;
76import static org .junit .jupiter .api .Assertions .assertTrue ;
87import static org .schabi .newpipe .extractor .ExtractorAsserts .assertContains ;
9- import static org .schabi .newpipe .extractor .ExtractorAsserts .assertIsSecureUrl ;
8+ import static org .schabi .newpipe .extractor .ExtractorAsserts .assertEmpty ;
109import static org .schabi .newpipe .extractor .ExtractorAsserts .assertNotBlank ;
1110import static org .schabi .newpipe .extractor .ExtractorAsserts .assertTabsContain ;
1211import static org .schabi .newpipe .extractor .ServiceList .YouTube ;
@@ -203,17 +202,13 @@ public void testDescription() throws Exception {
203202 }
204203
205204 @ Test
206- public void testAvatarUrl () throws Exception {
207- String avatarUrl = extractor .getAvatarUrl ();
208- assertIsSecureUrl (avatarUrl );
209- assertContains ("yt3" , avatarUrl );
205+ public void testAvatars () throws Exception {
206+ YoutubeTestsUtils .testImages (extractor .getAvatars ());
210207 }
211208
212209 @ Test
213- public void testBannerUrl () throws Exception {
214- String bannerUrl = extractor .getBannerUrl ();
215- assertIsSecureUrl (bannerUrl );
216- assertContains ("yt3" , bannerUrl );
210+ public void testBanners () throws Exception {
211+ YoutubeTestsUtils .testImages (extractor .getBanners ());
217212 }
218213
219214 @ Test
@@ -226,6 +221,7 @@ public void testSubscriberCount() throws Exception {
226221 ExtractorAsserts .assertGreaterOrEqual (4_900_000 , extractor .getSubscriberCount ());
227222 }
228223
224+ @ Test
229225 @ Override
230226 public void testVerified () throws Exception {
231227 assertTrue (extractor .isVerified ());
@@ -248,7 +244,7 @@ public void testTags() throws Exception {
248244 }
249245 }
250246
251- // Youtube RED/Premium ad blocking test
247+ // YouTube RED/Premium ad blocking test
252248 public static class VSauce implements BaseChannelExtractorTest {
253249 private static YoutubeChannelExtractor extractor ;
254250
@@ -300,17 +296,13 @@ public void testDescription() throws Exception {
300296 }
301297
302298 @ Test
303- public void testAvatarUrl () throws Exception {
304- String avatarUrl = extractor .getAvatarUrl ();
305- assertIsSecureUrl (avatarUrl );
306- assertContains ("yt3" , avatarUrl );
299+ public void testAvatars () throws Exception {
300+ YoutubeTestsUtils .testImages (extractor .getAvatars ());
307301 }
308302
309303 @ Test
310- public void testBannerUrl () throws Exception {
311- String bannerUrl = extractor .getBannerUrl ();
312- assertIsSecureUrl (bannerUrl );
313- assertContains ("yt3" , bannerUrl );
304+ public void testBanners () throws Exception {
305+ YoutubeTestsUtils .testImages (extractor .getBanners ());
314306 }
315307
316308 @ Test
@@ -400,17 +392,13 @@ public void testDescription() throws Exception {
400392 }
401393
402394 @ Test
403- public void testAvatarUrl () throws Exception {
404- String avatarUrl = extractor .getAvatarUrl ();
405- assertIsSecureUrl (avatarUrl );
406- assertContains ("yt3" , avatarUrl );
395+ public void testAvatars () throws Exception {
396+ YoutubeTestsUtils .testImages (extractor .getAvatars ());
407397 }
408398
409399 @ Test
410- public void testBannerUrl () throws Exception {
411- String bannerUrl = extractor .getBannerUrl ();
412- assertIsSecureUrl (bannerUrl );
413- assertContains ("yt3" , bannerUrl );
400+ public void testBanners () throws Exception {
401+ YoutubeTestsUtils .testImages (extractor .getBanners ());
414402 }
415403
416404 @ Test
@@ -524,17 +512,13 @@ public void testDescription() throws Exception {
524512 }
525513
526514 @ Test
527- public void testAvatarUrl () throws Exception {
528- String avatarUrl = extractor .getAvatarUrl ();
529- assertIsSecureUrl (avatarUrl );
530- assertContains ("yt3" , avatarUrl );
515+ public void testAvatars () throws Exception {
516+ YoutubeTestsUtils .testImages (extractor .getAvatars ());
531517 }
532518
533519 @ Test
534- public void testBannerUrl () throws Exception {
535- String bannerUrl = extractor .getBannerUrl ();
536- assertIsSecureUrl (bannerUrl );
537- assertContains ("yt3" , bannerUrl );
520+ public void testBanners () throws Exception {
521+ YoutubeTestsUtils .testImages (extractor .getBanners ());
538522 }
539523
540524 @ Test
@@ -621,17 +605,13 @@ public void testDescription() throws Exception {
621605 }
622606
623607 @ Test
624- public void testAvatarUrl () throws Exception {
625- String avatarUrl = extractor .getAvatarUrl ();
626- assertIsSecureUrl (avatarUrl );
627- assertContains ("yt3" , avatarUrl );
608+ public void testAvatars () throws Exception {
609+ YoutubeTestsUtils .testImages (extractor .getAvatars ());
628610 }
629611
630612 @ Test
631- public void testBannerUrl () throws Exception {
632- String bannerUrl = extractor .getBannerUrl ();
633- assertIsSecureUrl (bannerUrl );
634- assertContains ("yt3" , bannerUrl );
613+ public void testBanners () throws Exception {
614+ YoutubeTestsUtils .testImages (extractor .getBanners ());
635615 }
636616
637617 @ Test
@@ -689,7 +669,7 @@ public void testServiceId() {
689669
690670 @ Test
691671 public void testName () throws Exception {
692- assertEquals (extractor .getName (), "Coachella" );
672+ assertEquals ("Coachella" , extractor .getName ());
693673 }
694674
695675 @ Test
@@ -718,16 +698,14 @@ public void testDescription() throws ParsingException {
718698 }
719699
720700 @ Test
721- public void testAvatarUrl () throws Exception {
722- String avatarUrl = extractor .getAvatarUrl ();
723- assertIsSecureUrl (avatarUrl );
724- assertContains ("yt3" , avatarUrl );
701+ public void testAvatars () throws Exception {
702+ YoutubeTestsUtils .testImages (extractor .getAvatars ());
725703 }
726704
727705 @ Test
728- public void testBannerUrl () throws Exception {
729- // CarouselHeaderRenders do not contain a banner
730- assertNull (extractor .getBannerUrl ());
706+ public void testBanners () {
707+ // A CarouselHeaderRenderer doesn't contain a banner
708+ assertEmpty (extractor .getBanners ());
731709 }
732710
733711 @ Test
@@ -795,17 +773,15 @@ public void testDescription() throws Exception {
795773
796774 @ Test
797775 @ Override
798- public void testAvatarUrl () throws Exception {
799- final String avatarUrl = extractor .getAvatarUrl ();
800- assertIsSecureUrl (avatarUrl );
801- assertContains ("yt3" , avatarUrl );
776+ public void testAvatars () throws Exception {
777+ YoutubeTestsUtils .testImages (extractor .getAvatars ());
802778 }
803779
804780 @ Test
805781 @ Override
806- public void testBannerUrl () throws Exception {
782+ public void testBanners () throws Exception {
807783 // Banners cannot be extracted from age-restricted channels
808- assertTrue ( isNullOrEmpty ( extractor .getBannerUrl () ));
784+ assertEmpty ( extractor .getBanners ( ));
809785 }
810786
811787 @ Test
@@ -913,18 +889,14 @@ public void testDescription() throws Exception {
913889
914890 @ Test
915891 @ Override
916- public void testAvatarUrl () throws Exception {
917- final String avatarUrl = extractor .getAvatarUrl ();
918- assertIsSecureUrl (avatarUrl );
919- assertContains ("yt3" , avatarUrl );
892+ public void testAvatars () throws Exception {
893+ YoutubeTestsUtils .testImages (extractor .getAvatars ());
920894 }
921895
922896 @ Test
923897 @ Override
924- public void testBannerUrl () throws Exception {
925- final String bannerUrl = extractor .getBannerUrl ();
926- assertIsSecureUrl (bannerUrl );
927- assertContains ("yt3" , bannerUrl );
898+ public void testBanners () throws Exception {
899+ YoutubeTestsUtils .testImages (extractor .getBanners ());
928900 }
929901
930902 @ Test
0 commit comments