Skip to content

Commit 5b0ec69

Browse files
committed
Add requested changes.
1 parent d290d2e commit 5b0ec69

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ public boolean isUploaderVerified() throws ParsingException {
207207
* The subscriber count of the uploader.
208208
* If the subscriber count is not implemented, or is unavailable, return <code>-1</code>.
209209
*
210-
* @return the subscriber count of the uploader or -1 if not available
210+
* @return the subscriber count of the uploader or {@value UNKNOWN_SUBSCRIBER_COUNT} if not available
211211
* @throws ParsingException
212212
*/
213213
public long getUploaderSubscriberCount() throws ParsingException {
214-
return -1;
214+
return UNKNOWN_SUBSCRIBER_COUNT;
215215
}
216216

217217
/**

extractor/src/test/java/org/schabi/newpipe/extractor/services/DefaultStreamExtractorTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
3535
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsValidUrl;
3636
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestListOfItems;
37+
import static org.schabi.newpipe.extractor.stream.StreamExtractor.UNKNOWN_SUBSCRIBER_COUNT;
3738

3839
/**
3940
* Test for {@link StreamExtractor}
@@ -45,7 +46,7 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
4546
public abstract String expectedUploaderName();
4647
public abstract String expectedUploaderUrl();
4748
public boolean expectedUploaderVerified() { return false; }
48-
public long expectedUploaderSubscriberCountAtLeast() { return -1; }
49+
public long expectedUploaderSubscriberCountAtLeast() { return UNKNOWN_SUBSCRIBER_COUNT; }
4950
public String expectedSubChannelName() { return ""; } // default: there is no subchannel
5051
public String expectedSubChannelUrl() { return ""; } // default: there is no subchannel
5152
public boolean expectedDescriptionIsEmpty() { return false; } // default: description is not empty
@@ -109,7 +110,11 @@ public void testUploaderVerified() throws Exception {
109110
@Test
110111
@Override
111112
public void testSubscriberCount() throws Exception {
112-
assertGreaterOrEqual(expectedUploaderSubscriberCountAtLeast(), extractor().getUploaderSubscriberCount());
113+
if (expectedUploaderSubscriberCountAtLeast() == UNKNOWN_SUBSCRIBER_COUNT) {
114+
assertEquals(UNKNOWN_SUBSCRIBER_COUNT, extractor().getUploaderSubscriberCount());
115+
} else {
116+
assertGreaterOrEqual(expectedUploaderSubscriberCountAtLeast(), extractor().getUploaderSubscriberCount());
117+
}
113118
}
114119

115120
@Test

0 commit comments

Comments
 (0)