diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioStreamExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioStreamExtractorTest.java index 760a833f7..2da8ec913 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioStreamExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioStreamExtractorTest.java @@ -6,8 +6,10 @@ import org.schabi.newpipe.DownloaderTestImpl; import org.schabi.newpipe.extractor.Extractor; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ExtractionException; +import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampRadioStreamExtractor; import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampStreamExtractor; +import org.schabi.newpipe.extractor.stream.StreamExtractor; import java.io.IOException; @@ -16,9 +18,15 @@ import static org.schabi.newpipe.extractor.ServiceList.Bandcamp; public class BandcampRadioStreamExtractorTest { + private static StreamExtractor e; + + private static final String SHOW_URL = "https://bandcamp.com/?show=230"; + @BeforeClass - public static void setUp() { + public static void setUp() throws IOException, ExtractionException { NewPipe.init(DownloaderTestImpl.getInstance()); + e = Bandcamp.getStreamExtractor(SHOW_URL); + e.fetchPage(); } @Test @@ -28,10 +36,69 @@ public class BandcampRadioStreamExtractorTest { } @Test - public void testExtracting() throws ExtractionException, IOException { - BandcampRadioStreamExtractor e = (BandcampRadioStreamExtractor) Bandcamp.getStreamExtractor("https://bandcamp.com/?show=230"); - e.fetchPage(); + public void testGetName() throws ParsingException { assertEquals("Sound Movements", e.getName()); + } + + @Test + public void testGetUploaderUrl() { + } + + @Test + public void testGetUrl() throws ParsingException { + assertEquals(SHOW_URL, e.getUrl()); + } + + @Test + public void testGetUploaderName() throws ParsingException { assertEquals("Andrew Jervis", e.getUploaderName()); } + + @Test + public void testGetTextualUploadDate() throws ParsingException { + assertEquals("16 May 2017", e.getTextualUploadDate()); + + } + + @Test + public void testGetThumbnailUrl() throws ParsingException { + assertTrue(e.getThumbnailUrl().contains("bcbits.com/img")); + } + + @Test + public void testGetUploaderAvatarUrl() throws ParsingException { + assertTrue(e.getUploaderAvatarUrl().contains("bandcamp-button")); + + } + + @Test + public void testGetDescription() throws ParsingException { + assertEquals("Featuring special guests Nick Hakim and Elbows, plus fresh cuts from Eddie Palmieri, KRS One, Ladi6, and Moonchild.", e.getDescription().getContent()); + + } + + @Test + public void testGetLength() throws ParsingException { + assertEquals(5619, e.getLength()); + } + + @Test + public void testGetAudioStreams() throws ExtractionException, IOException { + assertEquals(2, e.getAudioStreams().size()); + } + + @Test + public void testGetLicence() throws ParsingException { + assertEquals("", e.getLicence()); + } + + @Test + public void testGetCategory() throws ParsingException { + assertEquals("", e.getCategory()); + } + + @Test + public void testGetTags() throws ParsingException { + assertEquals(0, e.getTags().size()); + } }