Add requested changes.

This commit is contained in:
FireMasterK 2022-02-22 07:15:25 +00:00
parent d290d2e393
commit 5b0ec694a6
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
2 changed files with 9 additions and 4 deletions

View File

@ -207,11 +207,11 @@ public abstract class StreamExtractor extends Extractor {
* The subscriber count of the uploader.
* If the subscriber count is not implemented, or is unavailable, return <code>-1</code>.
*
* @return the subscriber count of the uploader or -1 if not available
* @return the subscriber count of the uploader or {@value UNKNOWN_SUBSCRIBER_COUNT} if not available
* @throws ParsingException
*/
public long getUploaderSubscriberCount() throws ParsingException {
return -1;
return UNKNOWN_SUBSCRIBER_COUNT;
}
/**

View File

@ -34,6 +34,7 @@ import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEqualsOrderInd
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsValidUrl;
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestListOfItems;
import static org.schabi.newpipe.extractor.stream.StreamExtractor.UNKNOWN_SUBSCRIBER_COUNT;
/**
* Test for {@link StreamExtractor}
@ -45,7 +46,7 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
public abstract String expectedUploaderName();
public abstract String expectedUploaderUrl();
public boolean expectedUploaderVerified() { return false; }
public long expectedUploaderSubscriberCountAtLeast() { return -1; }
public long expectedUploaderSubscriberCountAtLeast() { return UNKNOWN_SUBSCRIBER_COUNT; }
public String expectedSubChannelName() { return ""; } // default: there is no subchannel
public String expectedSubChannelUrl() { return ""; } // default: there is no subchannel
public boolean expectedDescriptionIsEmpty() { return false; } // default: description is not empty
@ -109,7 +110,11 @@ public abstract class DefaultStreamExtractorTest extends DefaultExtractorTest<St
@Test
@Override
public void testSubscriberCount() throws Exception {
assertGreaterOrEqual(expectedUploaderSubscriberCountAtLeast(), extractor().getUploaderSubscriberCount());
if (expectedUploaderSubscriberCountAtLeast() == UNKNOWN_SUBSCRIBER_COUNT) {
assertEquals(UNKNOWN_SUBSCRIBER_COUNT, extractor().getUploaderSubscriberCount());
} else {
assertGreaterOrEqual(expectedUploaderSubscriberCountAtLeast(), extractor().getUploaderSubscriberCount());
}
}
@Test