add tests for ContentNotSupportedException

This commit is contained in:
bopol 2020-04-01 21:50:28 +02:00
parent 093762e793
commit a22104cbda
1 changed files with 125 additions and 97 deletions

View File

@ -5,6 +5,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.schabi.newpipe.DownloaderTestImpl;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream.StreamExtractor;
@ -25,6 +26,8 @@ import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
* Test for {@link StreamExtractor}
*/
public class SoundcloudStreamExtractorDefaultTest {
public static class LilUziVertDoWhatIWant {
private static SoundcloudStreamExtractor extractor;
@BeforeClass
@ -129,3 +132,28 @@ public class SoundcloudStreamExtractorDefaultTest {
assertTrue(extractor.getSubtitlesDefault().isEmpty());
}
}
public static class ContentNotSupported {
@BeforeClass
public static void setUp() {
NewPipe.init(DownloaderTestImpl.getInstance());
}
@Test(expected = ContentNotSupportedException.class)
public void hlsAudioStream() throws Exception {
final StreamExtractor extractor =
SoundCloud.getStreamExtractor("https://soundcloud.com/dualipa/cool");
extractor.fetchPage();
extractor.getAudioStreams();
}
@Test(expected = ContentNotSupportedException.class)
public void bothHlsAndOpusAudioStreams() throws Exception {
final StreamExtractor extractor =
SoundCloud.getStreamExtractor("https://soundcloud.com/lil-baby-4pf/no-sucker");
extractor.fetchPage();
extractor.getAudioStreams();
}
}
}