Skip to content

Commit d5043cd

Browse files
committed
Add test for subscriptions with empty title.
(youtube subscription extractor)
1 parent 03893ab commit d5043cd

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ public void testEmptySourceException() throws Exception {
5959
assertTrue(items.isEmpty());
6060
}
6161

62+
@Test
63+
public void testSubscriptionWithEmptyTitleInSource() throws Exception {
64+
String channelName = "NAME OF CHANNEL";
65+
String emptySource = "<opml version=\"1.1\"><body><outline text=\"YouTube Subscriptions\" title=\"YouTube Subscriptions\">" +
66+
67+
"<outline text=\"\" title=\"\" type=\"rss\" xmlUrl=\"https://www.youtube.com/feeds/videos.xml?channel_id=AA0AaAa0AaaaAAAAAA0aa0AA\" />" +
68+
69+
"<outline text=\"" + channelName + "\" title=\"" + channelName +
70+
"\" type=\"rss\" xmlUrl=\"https://www.youtube.com/feeds/videos.xml?channel_id=AA0AaAa0AaaaAAAAAA0aa0AA\" />" +
71+
72+
"</outline></body></opml>";
73+
74+
List<SubscriptionItem> items = subscriptionExtractor.fromInputStream(new ByteArrayInputStream(emptySource.getBytes("UTF-8")));
75+
assertTrue("List doesn't have exactly 1 item (had " + items.size() + ")", items.size() == 1);
76+
assertTrue("Item does not have the right title \"" + channelName + "\" (had \"" + items.get(0).getName() + "\")", items.get(0).getName().equals(channelName));
77+
}
78+
6279
@Test
6380
public void testInvalidSourceException() {
6481
List<String> invalidList = Arrays.asList(

0 commit comments

Comments
 (0)