add tests for ContentNotSupportedException
This commit is contained in:
parent
093762e793
commit
a22104cbda
1 changed files with 125 additions and 97 deletions
|
@ -5,6 +5,7 @@ import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.schabi.newpipe.DownloaderTestImpl;
|
import org.schabi.newpipe.DownloaderTestImpl;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
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.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
||||||
|
@ -25,6 +26,8 @@ import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
||||||
* Test for {@link StreamExtractor}
|
* Test for {@link StreamExtractor}
|
||||||
*/
|
*/
|
||||||
public class SoundcloudStreamExtractorDefaultTest {
|
public class SoundcloudStreamExtractorDefaultTest {
|
||||||
|
|
||||||
|
public static class LilUziVertDoWhatIWant {
|
||||||
private static SoundcloudStreamExtractor extractor;
|
private static SoundcloudStreamExtractor extractor;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
@ -128,4 +131,29 @@ public class SoundcloudStreamExtractorDefaultTest {
|
||||||
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null
|
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null
|
||||||
assertTrue(extractor.getSubtitlesDefault().isEmpty());
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue