From d5043cdf499db72138ef15e429d040bf3e12a574 Mon Sep 17 00:00:00 2001 From: Stypox Date: Fri, 26 Apr 2019 19:59:23 +0200 Subject: [PATCH] Add test for subscriptions with empty title. (youtube subscription extractor) --- .../YoutubeSubscriptionExtractorTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java index 8d2e6cfae..8b23b129e 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java @@ -59,6 +59,23 @@ public class YoutubeSubscriptionExtractorTest { assertTrue(items.isEmpty()); } + @Test + public void testSubscriptionWithEmptyTitleInSource() throws Exception { + String channelName = "NAME OF CHANNEL"; + String emptySource = "" + + + "" + + + "" + + + ""; + + List items = subscriptionExtractor.fromInputStream(new ByteArrayInputStream(emptySource.getBytes("UTF-8"))); + assertTrue("List doesn't have exactly 1 item (had " + items.size() + ")", items.size() == 1); + assertTrue("Item does not have the right title \"" + channelName + "\" (had \"" + items.get(0).getName() + "\")", items.get(0).getName().equals(channelName)); + } + @Test public void testInvalidSourceException() { List invalidList = Arrays.asList(