Store errors that can happen during extraction of the next page
- Closes #24
This commit is contained in:
@@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor.services.soundcloud;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
||||
|
||||
@@ -70,7 +71,9 @@ public class SoundcloudChannelExtractorTest {
|
||||
public void testGetNextStreams() throws Exception {
|
||||
// Setup the streams
|
||||
extractor.getStreams();
|
||||
assertTrue("extractor didn't have next streams", !extractor.getNextStreams().nextItemsList.isEmpty());
|
||||
ListExtractor.NextItemsResult nextItemsResult = extractor.getNextStreams();
|
||||
assertTrue("extractor didn't have next streams", !nextItemsResult.nextItemsList.isEmpty());
|
||||
assertTrue("errors occurred during extraction of the next streams", nextItemsResult.errors.isEmpty());
|
||||
assertTrue("extractor didn't have more streams after getNextStreams", extractor.hasMoreStreams());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
@@ -79,4 +80,15 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
extractor.getStreams();
|
||||
assertTrue("extractor didn't have more streams", !extractor.hasMoreStreams());
|
||||
}
|
||||
|
||||
@Test(expected = ExtractionException.class)
|
||||
public void testGetNextStreamsNonExistent() throws Exception {
|
||||
// Setup the streams
|
||||
extractor.getStreams();
|
||||
|
||||
// This playlist don't have more streams, it should throw an error
|
||||
extractor.getNextStreams();
|
||||
|
||||
fail("Expected exception wasn't thrown");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor.services.youtube;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
||||
|
||||
@@ -99,7 +100,9 @@ public class YoutubeChannelExtractorTest {
|
||||
public void testGetNextStreams() throws Exception {
|
||||
// Setup the streams
|
||||
extractor.getStreams();
|
||||
assertTrue("extractor didn't have next streams", !extractor.getNextStreams().nextItemsList.isEmpty());
|
||||
ListExtractor.NextItemsResult nextItemsResult = extractor.getNextStreams();
|
||||
assertTrue("extractor didn't have next streams", !nextItemsResult.nextItemsList.isEmpty());
|
||||
assertTrue("errors occurred during extraction of the next streams", nextItemsResult.errors.isEmpty());
|
||||
assertTrue("extractor didn't have more streams after getNextStreams", extractor.hasMoreStreams());
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor.services.youtube;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
|
||||
|
||||
@@ -89,7 +90,9 @@ public class YoutubePlaylistExtractorTest {
|
||||
public void testGetNextStreams() throws Exception {
|
||||
// Setup the streams
|
||||
extractor.getStreams();
|
||||
assertTrue("extractor didn't have next streams", !extractor.getNextStreams().nextItemsList.isEmpty());
|
||||
ListExtractor.NextItemsResult nextItemsResult = extractor.getNextStreams();
|
||||
assertTrue("extractor didn't have next streams", !nextItemsResult.nextItemsList.isEmpty());
|
||||
assertTrue("errors occurred during extraction of the next streams", nextItemsResult.errors.isEmpty());
|
||||
assertTrue("extractor didn't have more streams after getNextStreams", extractor.hasMoreStreams());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user