NewPipeExtractor/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelTabExtract...

210 lines
6.7 KiB
Java
Raw Normal View History

2022-10-25 21:13:16 +02:00
package org.schabi.newpipe.extractor.services.soundcloud;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.schabi.newpipe.downloader.DownloaderTestImpl;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
import org.schabi.newpipe.extractor.channel.ChannelTabExtractor;
2022-10-25 21:13:16 +02:00
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
2022-11-04 23:47:44 +01:00
import org.schabi.newpipe.extractor.linkhandler.ChannelTabs;
import org.schabi.newpipe.extractor.services.BaseListExtractorTest;
2022-10-25 21:13:16 +02:00
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelTabExtractor;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
import static org.schabi.newpipe.extractor.services.DefaultTests.*;
2022-10-25 21:13:16 +02:00
public class SoundcloudChannelTabExtractorTest {
public static class Tracks implements BaseListExtractorTest {
private static SoundcloudChannelTabExtractor extractor;
@BeforeAll
public static void setUp() throws IOException, ExtractionException {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (SoundcloudChannelTabExtractor) SoundCloud
.getChannelTabExtractorFromId("10494998", ChannelTabs.TRACKS);
extractor.fetchPage();
}
@Test
@Override
public void testServiceId() throws Exception {
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
}
@Test
@Override
public void testName() throws Exception {
assertEquals(ChannelTabs.TRACKS, extractor.getName());
}
@Test
public void testTab() {
assertEquals(ChannelTabs.TRACKS, extractor.getTab());
}
@Test
@Override
public void testId() throws Exception {
assertEquals("10494998", extractor.getId());
}
@Test
@Override
public void testUrl() throws Exception {
assertEquals("https://soundcloud.com/liluzivert/tracks", extractor.getUrl());
}
@Test
@Override
public void testOriginalUrl() throws Exception {
assertEquals("https://soundcloud.com/liluzivert/tracks", extractor.getOriginalUrl());
}
@Test
@Override
public void testRelatedItems() throws Exception {
defaultTestRelatedItems(extractor);
}
@Test
@Override
public void testMoreRelatedItems() throws Exception {
defaultTestMoreItems(extractor);
}
/*//////////////////////////////////////////////////////////////////////////
// Additional Testing
//////////////////////////////////////////////////////////////////////////*/
@Test
public void testGetPageInNewExtractor() throws Exception {
final ChannelTabExtractor newTabExtractor =
SoundCloud.getChannelTabExtractorFromId("10494998", ChannelTabs.TRACKS);
defaultTestGetPageInNewExtractor(extractor, newTabExtractor);
}
}
public static class Playlists implements BaseListExtractorTest {
2022-10-25 21:13:16 +02:00
private static SoundcloudChannelTabExtractor extractor;
@BeforeAll
public static void setUp() throws IOException, ExtractionException {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (SoundcloudChannelTabExtractor) SoundCloud
2022-11-04 23:47:44 +01:00
.getChannelTabExtractorFromId("323371733", ChannelTabs.PLAYLISTS);
2022-10-25 21:13:16 +02:00
extractor.fetchPage();
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testServiceId() {
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
}
@Test
@Override
public void testName() throws Exception {
assertEquals(ChannelTabs.PLAYLISTS, extractor.getName());
}
2022-10-25 21:13:16 +02:00
@Test
public void testTab() {
2022-11-04 23:47:44 +01:00
assertEquals(ChannelTabs.PLAYLISTS, extractor.getTab());
2022-10-25 21:13:16 +02:00
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testId() throws ParsingException {
assertEquals("323371733", extractor.getId());
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testUrl() throws ParsingException {
assertEquals("https://soundcloud.com/trackaholic/sets", extractor.getUrl());
}
@Test
@Override
public void testOriginalUrl() throws Exception {
assertEquals("https://soundcloud.com/trackaholic/sets", extractor.getOriginalUrl());
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testRelatedItems() throws Exception {
defaultTestRelatedItems(extractor);
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testMoreRelatedItems() throws Exception {
defaultTestMoreItems(extractor);
}
}
public static class Albums implements BaseListExtractorTest {
2022-10-25 21:13:16 +02:00
private static SoundcloudChannelTabExtractor extractor;
@BeforeAll
public static void setUp() throws IOException, ExtractionException {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (SoundcloudChannelTabExtractor) SoundCloud
2022-11-04 23:47:44 +01:00
.getChannelTabExtractorFromId("4803918", ChannelTabs.ALBUMS);
2022-10-25 21:13:16 +02:00
extractor.fetchPage();
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testServiceId() {
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
}
@Test
@Override
public void testName() throws Exception {
assertEquals(ChannelTabs.ALBUMS, extractor.getName());
}
2022-10-25 21:13:16 +02:00
@Test
public void testTab() {
2022-11-04 23:47:44 +01:00
assertEquals(ChannelTabs.ALBUMS, extractor.getTab());
2022-10-25 21:13:16 +02:00
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testId() throws ParsingException {
assertEquals("4803918", extractor.getId());
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testUrl() throws ParsingException {
assertEquals("https://soundcloud.com/bigsean-1/albums", extractor.getUrl());
}
@Test
@Override
public void testOriginalUrl() throws Exception {
assertEquals("https://soundcloud.com/bigsean-1/albums", extractor.getOriginalUrl());
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testRelatedItems() throws Exception {
defaultTestRelatedItems(extractor);
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testMoreRelatedItems() throws Exception {
defaultTestMoreItems(extractor);
}
}
}