[YouTube] Apply changes in extractor tests
Also remove some public test methods modifiers, add missing Test annotations on old Junit 4 tests (and update them if needed), and use final in some places where it was possible.
This commit is contained in:
parent
2c436d428c
commit
93a210394d
|
@ -2,11 +2,10 @@ package org.schabi.newpipe.extractor.services.youtube;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertNotBlank;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContain;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
|
@ -203,17 +202,13 @@ public class YoutubeChannelExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAvatarUrl() throws Exception {
|
||||
String avatarUrl = extractor.getAvatarUrl();
|
||||
assertIsSecureUrl(avatarUrl);
|
||||
assertContains("yt3", avatarUrl);
|
||||
public void testAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBannerUrl() throws Exception {
|
||||
String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
assertContains("yt3", bannerUrl);
|
||||
public void testBanners() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -226,6 +221,7 @@ public class YoutubeChannelExtractorTest {
|
|||
ExtractorAsserts.assertGreaterOrEqual(4_900_000, extractor.getSubscriberCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testVerified() throws Exception {
|
||||
assertTrue(extractor.isVerified());
|
||||
|
@ -248,7 +244,7 @@ public class YoutubeChannelExtractorTest {
|
|||
}
|
||||
}
|
||||
|
||||
// Youtube RED/Premium ad blocking test
|
||||
// YouTube RED/Premium ad blocking test
|
||||
public static class VSauce implements BaseChannelExtractorTest {
|
||||
private static YoutubeChannelExtractor extractor;
|
||||
|
||||
|
@ -300,17 +296,13 @@ public class YoutubeChannelExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAvatarUrl() throws Exception {
|
||||
String avatarUrl = extractor.getAvatarUrl();
|
||||
assertIsSecureUrl(avatarUrl);
|
||||
assertContains("yt3", avatarUrl);
|
||||
public void testAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBannerUrl() throws Exception {
|
||||
String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
assertContains("yt3", bannerUrl);
|
||||
public void testBanners() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -400,17 +392,13 @@ public class YoutubeChannelExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAvatarUrl() throws Exception {
|
||||
String avatarUrl = extractor.getAvatarUrl();
|
||||
assertIsSecureUrl(avatarUrl);
|
||||
assertContains("yt3", avatarUrl);
|
||||
public void testAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBannerUrl() throws Exception {
|
||||
String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
assertContains("yt3", bannerUrl);
|
||||
public void testBanners() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -524,17 +512,13 @@ public class YoutubeChannelExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAvatarUrl() throws Exception {
|
||||
String avatarUrl = extractor.getAvatarUrl();
|
||||
assertIsSecureUrl(avatarUrl);
|
||||
assertContains("yt3", avatarUrl);
|
||||
public void testAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBannerUrl() throws Exception {
|
||||
String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
assertContains("yt3", bannerUrl);
|
||||
public void testBanners() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -621,17 +605,13 @@ public class YoutubeChannelExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAvatarUrl() throws Exception {
|
||||
String avatarUrl = extractor.getAvatarUrl();
|
||||
assertIsSecureUrl(avatarUrl);
|
||||
assertContains("yt3", avatarUrl);
|
||||
public void testAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBannerUrl() throws Exception {
|
||||
String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
assertContains("yt3", bannerUrl);
|
||||
public void testBanners() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -689,7 +669,7 @@ public class YoutubeChannelExtractorTest {
|
|||
|
||||
@Test
|
||||
public void testName() throws Exception {
|
||||
assertEquals(extractor.getName(), "Coachella");
|
||||
assertEquals("Coachella", extractor.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -718,16 +698,14 @@ public class YoutubeChannelExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAvatarUrl() throws Exception {
|
||||
String avatarUrl = extractor.getAvatarUrl();
|
||||
assertIsSecureUrl(avatarUrl);
|
||||
assertContains("yt3", avatarUrl);
|
||||
public void testAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBannerUrl() throws Exception {
|
||||
// CarouselHeaderRenders do not contain a banner
|
||||
assertNull(extractor.getBannerUrl());
|
||||
public void testBanners() {
|
||||
// A CarouselHeaderRenderer doesn't contain a banner
|
||||
assertEmpty(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -795,17 +773,15 @@ public class YoutubeChannelExtractorTest {
|
|||
|
||||
@Test
|
||||
@Override
|
||||
public void testAvatarUrl() throws Exception {
|
||||
final String avatarUrl = extractor.getAvatarUrl();
|
||||
assertIsSecureUrl(avatarUrl);
|
||||
assertContains("yt3", avatarUrl);
|
||||
public void testAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testBannerUrl() throws Exception {
|
||||
public void testBanners() throws Exception {
|
||||
// Banners cannot be extracted from age-restricted channels
|
||||
assertTrue(isNullOrEmpty(extractor.getBannerUrl()));
|
||||
assertEmpty(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -913,18 +889,14 @@ public class YoutubeChannelExtractorTest {
|
|||
|
||||
@Test
|
||||
@Override
|
||||
public void testAvatarUrl() throws Exception {
|
||||
final String avatarUrl = extractor.getAvatarUrl();
|
||||
assertIsSecureUrl(avatarUrl);
|
||||
assertContains("yt3", avatarUrl);
|
||||
public void testAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testBannerUrl() throws Exception {
|
||||
final String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
assertContains("yt3", bannerUrl);
|
||||
public void testBanners() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -49,7 +49,7 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetComments() throws IOException, ExtractionException {
|
||||
void testGetComments() throws IOException, ExtractionException {
|
||||
assertTrue(getCommentsHelper(extractor));
|
||||
}
|
||||
|
||||
|
@ -66,11 +66,11 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
|
||||
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
|
||||
assertTrue(getCommentsFromCommentsInfoHelper(url));
|
||||
}
|
||||
|
||||
private boolean getCommentsFromCommentsInfoHelper(String url) throws IOException, ExtractionException {
|
||||
private boolean getCommentsFromCommentsInfoHelper(final String url) throws IOException, ExtractionException {
|
||||
final CommentsInfo commentsInfo = CommentsInfo.getInfo(url);
|
||||
|
||||
assertEquals("Comments", commentsInfo.getName());
|
||||
|
@ -87,21 +87,21 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||
assertTrue(extractor.getCommentsCount() > 5); // at least 5 comments
|
||||
|
||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||
for (CommentsInfoItem c : comments.getItems()) {
|
||||
for (final CommentsInfoItem c : comments.getItems()) {
|
||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
||||
YoutubeTestsUtils.testImages(c.getUploaderAvatars());
|
||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
||||
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
||||
assertFalse(Utils.isBlank(c.getName()));
|
||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
||||
assertNotNull(c.getUploadDate());
|
||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
||||
YoutubeTestsUtils.testImages(c.getThumbnails());
|
||||
assertFalse(Utils.isBlank(c.getUrl()));
|
||||
assertTrue(c.getLikeCount() >= 0);
|
||||
}
|
||||
|
@ -138,19 +138,19 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||
|
||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||
for (CommentsInfoItem c : comments.getItems()) {
|
||||
for (final CommentsInfoItem c : comments.getItems()) {
|
||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
||||
YoutubeTestsUtils.testImages(c.getUploaderAvatars());
|
||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
||||
assertFalse(Utils.isBlank(c.getName()));
|
||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
||||
assertNotNull(c.getUploadDate());
|
||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
||||
YoutubeTestsUtils.testImages(c.getThumbnails());
|
||||
assertFalse(Utils.isBlank(c.getUrl()));
|
||||
assertTrue(c.getLikeCount() >= 0);
|
||||
if (c.getCommentId().equals("Ugga_h1-EXdHB3gCoAEC")) { // comment without text
|
||||
|
@ -177,22 +177,22 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||
|
||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||
|
||||
boolean heartedByUploader = false;
|
||||
|
||||
for (CommentsInfoItem c : comments.getItems()) {
|
||||
for (final CommentsInfoItem c : comments.getItems()) {
|
||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
||||
YoutubeTestsUtils.testImages(c.getUploaderAvatars());
|
||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
||||
assertFalse(Utils.isBlank(c.getName()));
|
||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
||||
assertNotNull(c.getUploadDate());
|
||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
||||
YoutubeTestsUtils.testImages(c.getThumbnails());
|
||||
assertFalse(Utils.isBlank(c.getUrl()));
|
||||
assertTrue(c.getLikeCount() >= 0);
|
||||
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
||||
|
@ -219,20 +219,20 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||
|
||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||
|
||||
for (CommentsInfoItem c : comments.getItems()) {
|
||||
for (final CommentsInfoItem c : comments.getItems()) {
|
||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
||||
YoutubeTestsUtils.testImages(c.getUploaderAvatars());
|
||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
||||
assertFalse(Utils.isBlank(c.getName()));
|
||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
||||
assertNotNull(c.getUploadDate());
|
||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
||||
YoutubeTestsUtils.testImages(c.getThumbnails());
|
||||
assertFalse(Utils.isBlank(c.getUrl()));
|
||||
assertTrue(c.getLikeCount() >= 0);
|
||||
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
||||
|
@ -260,7 +260,7 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsFirst() throws IOException, ExtractionException {
|
||||
void testGetCommentsFirst() throws IOException, ExtractionException {
|
||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||
|
||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||
|
@ -293,7 +293,7 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsFirst() throws IOException, ExtractionException {
|
||||
void testGetCommentsFirst() throws IOException, ExtractionException {
|
||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||
|
||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||
|
@ -319,7 +319,7 @@ public class YoutubeCommentsExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommentsFirstReplies() throws IOException, ExtractionException {
|
||||
void testGetCommentsFirstReplies() throws IOException, ExtractionException {
|
||||
final InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
||||
|
||||
DefaultTests.defaultTestListOfItems(YouTube, comments.getItems(), comments.getErrors());
|
||||
|
|
|
@ -4,7 +4,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL;
|
||||
|
@ -69,11 +68,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void getThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnailUrl);
|
||||
void getThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
extractor.getThumbnails().forEach(thumbnail ->
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -158,11 +156,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void getThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnailUrl);
|
||||
void getThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
extractor.getThumbnails().forEach(thumbnail ->
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -248,10 +245,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void getThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
assertTrue(thumbnailUrl.startsWith("https://i.ytimg.com/vi/" + VIDEO_ID));
|
||||
void getThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
extractor.getThumbnails().forEach(thumbnail ->
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -366,10 +363,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void getThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
void getThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
extractor.getThumbnails().forEach(thumbnail ->
|
||||
ExtractorAsserts.assertContains(VIDEO_ID_OF_CHANNEL, thumbnail.getUrl()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -433,11 +430,10 @@ public class YoutubeMixPlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void getThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnailUrl);
|
||||
void getThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
extractor.getThumbnails().forEach(thumbnail ->
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -523,10 +519,9 @@ public class YoutubeMixPlaylistExtractorTest {
|
|||
|
||||
@Test
|
||||
void getThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnailUrl);
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
extractor.getThumbnails().forEach(thumbnail ->
|
||||
ExtractorAsserts.assertContains(VIDEO_ID, thumbnail.getUrl()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
import static org.schabi.newpipe.extractor.services.DefaultTests.assertNoMoreItems;
|
||||
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor;
|
||||
|
@ -121,22 +120,17 @@ public class YoutubePlaylistExtractorTest {
|
|||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Test
|
||||
public void testThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testBannerUrl() throws ParsingException {
|
||||
final String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
ExtractorAsserts.assertContains("yt", bannerUrl);
|
||||
public void testThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderUrl() throws Exception {
|
||||
public void testBanners() throws ParsingException {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUploaderUrl() throws Exception {
|
||||
assertEquals("https://www.youtube.com/channel/UCs72iRpTEuwV3y6pdWYLgiw", extractor.getUploaderUrl());
|
||||
}
|
||||
|
||||
|
@ -147,9 +141,8 @@ public class YoutubePlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderAvatarUrl() throws Exception {
|
||||
final String uploaderAvatarUrl = extractor.getUploaderAvatarUrl();
|
||||
ExtractorAsserts.assertContains("yt", uploaderAvatarUrl);
|
||||
public void testUploaderAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getUploaderAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -157,6 +150,7 @@ public class YoutubePlaylistExtractorTest {
|
|||
ExtractorAsserts.assertGreater(100, extractor.getStreamCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testUploaderVerified() throws Exception {
|
||||
assertFalse(extractor.isUploaderVerified());
|
||||
|
@ -191,7 +185,7 @@ public class YoutubePlaylistExtractorTest {
|
|||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Test
|
||||
public void testGetPageInNewExtractor() throws Exception {
|
||||
void testGetPageInNewExtractor() throws Exception {
|
||||
final PlaylistExtractor newExtractor = YouTube.getPlaylistExtractor(extractor.getUrl());
|
||||
defaultTestGetPageInNewExtractor(extractor, newExtractor);
|
||||
}
|
||||
|
@ -251,22 +245,17 @@ public class YoutubePlaylistExtractorTest {
|
|||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Test
|
||||
public void testThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testBannerUrl() throws ParsingException {
|
||||
final String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
ExtractorAsserts.assertContains("yt", bannerUrl);
|
||||
public void testThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderUrl() throws Exception {
|
||||
public void testBanners() throws ParsingException {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUploaderUrl() throws Exception {
|
||||
assertEquals("https://www.youtube.com/channel/UCHSPWoY1J5fbDVbcnyeqwdw", extractor.getUploaderUrl());
|
||||
}
|
||||
|
||||
|
@ -276,9 +265,8 @@ public class YoutubePlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderAvatarUrl() throws Exception {
|
||||
final String uploaderAvatarUrl = extractor.getUploaderAvatarUrl();
|
||||
ExtractorAsserts.assertContains("yt", uploaderAvatarUrl);
|
||||
public void testUploaderAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getUploaderAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -286,9 +274,10 @@ public class YoutubePlaylistExtractorTest {
|
|||
ExtractorAsserts.assertGreater(100, extractor.getStreamCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testUploaderVerified() throws Exception {
|
||||
assertTrue(extractor.isUploaderVerified());
|
||||
assertFalse(extractor.isUploaderVerified());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -364,22 +353,17 @@ public class YoutubePlaylistExtractorTest {
|
|||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Test
|
||||
public void testThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testBannerUrl() throws ParsingException {
|
||||
final String bannerUrl = extractor.getBannerUrl();
|
||||
assertIsSecureUrl(bannerUrl);
|
||||
ExtractorAsserts.assertContains("yt", bannerUrl);
|
||||
public void testThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderUrl() throws Exception {
|
||||
public void testBanners() throws ParsingException {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUploaderUrl() throws Exception {
|
||||
assertEquals("https://www.youtube.com/channel/UCX6b17PVsYBQ0ip5gyeme-Q", extractor.getUploaderUrl());
|
||||
}
|
||||
|
||||
|
@ -390,9 +374,8 @@ public class YoutubePlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderAvatarUrl() throws Exception {
|
||||
final String uploaderAvatarUrl = extractor.getUploaderAvatarUrl();
|
||||
ExtractorAsserts.assertContains("yt", uploaderAvatarUrl);
|
||||
public void testUploaderAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getUploaderAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -400,9 +383,10 @@ public class YoutubePlaylistExtractorTest {
|
|||
ExtractorAsserts.assertGreater(40, extractor.getStreamCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testUploaderVerified() throws Exception {
|
||||
assertTrue(extractor.isUploaderVerified());
|
||||
assertFalse(extractor.isUploaderVerified());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -480,18 +464,14 @@ public class YoutubePlaylistExtractorTest {
|
|||
|
||||
@Test
|
||||
@Override
|
||||
public void testThumbnailUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
public void testThumbnails() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getThumbnails());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testBannerUrl() throws Exception {
|
||||
final String thumbnailUrl = extractor.getThumbnailUrl();
|
||||
assertIsSecureUrl(thumbnailUrl);
|
||||
ExtractorAsserts.assertContains("yt", thumbnailUrl);
|
||||
public void testBanners() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getBanners());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -501,10 +481,8 @@ public class YoutubePlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testUploaderAvatarUrl() throws Exception {
|
||||
final String uploaderAvatarUrl = extractor.getUploaderAvatarUrl();
|
||||
ExtractorAsserts.assertContains("yt", uploaderAvatarUrl);
|
||||
public void testUploaderAvatars() throws Exception {
|
||||
YoutubeTestsUtils.testImages(extractor.getUploaderAvatars());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -540,7 +518,7 @@ public class YoutubePlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNoContinuations() throws Exception {
|
||||
void testNoContinuations() throws Exception {
|
||||
final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor) YouTube
|
||||
.getPlaylistExtractor(
|
||||
"https://www.youtube.com/playlist?list=PLXJg25X-OulsVsnvZ7RVtSDW-id9_RzAO");
|
||||
|
@ -550,7 +528,7 @@ public class YoutubePlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOnlySingleContinuation() throws Exception {
|
||||
void testOnlySingleContinuation() throws Exception {
|
||||
final YoutubePlaylistExtractor extractor = (YoutubePlaylistExtractor) YouTube
|
||||
.getPlaylistExtractor(
|
||||
"https://www.youtube.com/playlist?list=PLoumn5BIsUDeGF1vy5Nylf_RJKn5aL_nr");
|
||||
|
|
|
@ -234,9 +234,9 @@ public class YoutubeSearchExtractorTest {
|
|||
}
|
||||
}
|
||||
|
||||
public static class PagingTest {
|
||||
static class PagingTest {
|
||||
@Test
|
||||
public void duplicatedItemsCheck() throws Exception {
|
||||
void duplicatedItemsCheck() throws Exception {
|
||||
YoutubeTestsUtils.ensureStateless();
|
||||
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "paging"));
|
||||
final SearchExtractor extractor = YouTube.getSearchExtractor("cirque du soleil", singletonList(VIDEOS), "");
|
||||
|
@ -275,7 +275,7 @@ public class YoutubeSearchExtractorTest {
|
|||
));
|
||||
}
|
||||
// testMoreRelatedItems is broken because a video has no duration shown
|
||||
@Override public void testMoreRelatedItems() { }
|
||||
@Test @Override public void testMoreRelatedItems() { }
|
||||
@Override public SearchExtractor extractor() { return extractor; }
|
||||
@Override public StreamingService expectedService() { return YouTube; }
|
||||
@Override public String expectedName() { return QUERY; }
|
||||
|
@ -307,7 +307,7 @@ public class YoutubeSearchExtractorTest {
|
|||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.CHANNEL; }
|
||||
|
||||
@Test
|
||||
public void testAtLeastOneVerified() throws IOException, ExtractionException {
|
||||
void testAtLeastOneVerified() throws IOException, ExtractionException {
|
||||
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
||||
boolean verified = false;
|
||||
for (InfoItem item : items) {
|
||||
|
@ -344,11 +344,14 @@ public class YoutubeSearchExtractorTest {
|
|||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
|
||||
|
||||
@Test
|
||||
public void testUploaderAvatar() throws IOException, ExtractionException {
|
||||
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
||||
for (final InfoItem item : items) {
|
||||
assertNotNull(((StreamInfoItem) item).getUploaderAvatarUrl());
|
||||
}
|
||||
void testUploaderAvatars() throws IOException, ExtractionException {
|
||||
extractor.getInitialPage()
|
||||
.getItems()
|
||||
.stream()
|
||||
.filter(StreamInfoItem.class::isInstance)
|
||||
.map(StreamInfoItem.class::cast)
|
||||
.forEach(streamInfoItem ->
|
||||
YoutubeTestsUtils.testImages(streamInfoItem.getUploaderAvatars()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,7 +378,7 @@ public class YoutubeSearchExtractorTest {
|
|||
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
|
||||
|
||||
@Test
|
||||
public void testVideoDescription() throws IOException, ExtractionException {
|
||||
void testVideoDescription() throws IOException, ExtractionException {
|
||||
final List<InfoItem> items = extractor.getInitialPage().getItems();
|
||||
assertNotNull(((StreamInfoItem) items.get(0)).getShortDescription());
|
||||
}
|
||||
|
|
|
@ -491,8 +491,8 @@ public class YoutubeStreamExtractorDefaultTest {
|
|||
|
||||
@Test
|
||||
@Override
|
||||
public void testUploaderAvatarUrl() {
|
||||
assertThrows(ParsingException.class, () -> extractor.getUploaderAvatarUrl());
|
||||
public void testUploaderAvatars() {
|
||||
assertThrows(ParsingException.class, () -> extractor.getUploaderAvatars());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
import static org.schabi.newpipe.extractor.services.youtube.stream.YoutubeStreamExtractorDefaultTest.YOUTUBE_LICENCE;
|
||||
|
||||
|
@ -109,7 +108,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
|
|||
assertContains(URL, streamMix.getUrl());
|
||||
assertContains("list=RD" + ID, streamMix.getUrl());
|
||||
assertEquals("Mix – " + TITLE, streamMix.getName());
|
||||
assertIsSecureUrl(streamMix.getThumbnailUrl());
|
||||
YoutubeTestsUtils.testImages(streamMix.getThumbnails());
|
||||
|
||||
final List<PlaylistInfoItem> musicMixes = playlists.stream()
|
||||
.filter(item -> item.getPlaylistType().equals(PlaylistType.MIX_MUSIC))
|
||||
|
@ -121,6 +120,6 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
|
|||
assertEquals(YouTube.getServiceId(), musicMix.getServiceId());
|
||||
assertContains("list=RDCLAK", musicMix.getUrl());
|
||||
assertEquals("Hip Hop Essentials", musicMix.getName());
|
||||
assertIsSecureUrl(musicMix.getThumbnailUrl());
|
||||
YoutubeTestsUtils.testImages(musicMix.getThumbnails());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue