210 lines
6.7 KiB
Java
210 lines
6.7 KiB
Java
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;
|
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
import org.schabi.newpipe.extractor.linkhandler.ChannelTabs;
|
|
import org.schabi.newpipe.extractor.services.BaseListExtractorTest;
|
|
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.*;
|
|
|
|
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 {
|
|
private static SoundcloudChannelTabExtractor extractor;
|
|
|
|
@BeforeAll
|
|
public static void setUp() throws IOException, ExtractionException {
|
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
|
extractor = (SoundcloudChannelTabExtractor) SoundCloud
|
|
.getChannelTabExtractorFromId("323371733", ChannelTabs.PLAYLISTS);
|
|
extractor.fetchPage();
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
public void testServiceId() {
|
|
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
public void testName() throws Exception {
|
|
assertEquals(ChannelTabs.PLAYLISTS, extractor.getName());
|
|
}
|
|
|
|
@Test
|
|
public void testTab() {
|
|
assertEquals(ChannelTabs.PLAYLISTS, extractor.getTab());
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
public void testId() throws ParsingException {
|
|
assertEquals("323371733", extractor.getId());
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
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
|
|
public void testRelatedItems() throws Exception {
|
|
defaultTestRelatedItems(extractor);
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
public void testMoreRelatedItems() throws Exception {
|
|
defaultTestMoreItems(extractor);
|
|
}
|
|
}
|
|
|
|
public static class Albums implements BaseListExtractorTest {
|
|
private static SoundcloudChannelTabExtractor extractor;
|
|
|
|
@BeforeAll
|
|
public static void setUp() throws IOException, ExtractionException {
|
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
|
extractor = (SoundcloudChannelTabExtractor) SoundCloud
|
|
.getChannelTabExtractorFromId("4803918", ChannelTabs.ALBUMS);
|
|
extractor.fetchPage();
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
public void testServiceId() {
|
|
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
public void testName() throws Exception {
|
|
assertEquals(ChannelTabs.ALBUMS, extractor.getName());
|
|
}
|
|
|
|
@Test
|
|
public void testTab() {
|
|
assertEquals(ChannelTabs.ALBUMS, extractor.getTab());
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
public void testId() throws ParsingException {
|
|
assertEquals("4803918", extractor.getId());
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
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
|
|
public void testRelatedItems() throws Exception {
|
|
defaultTestRelatedItems(extractor);
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
public void testMoreRelatedItems() throws Exception {
|
|
defaultTestMoreItems(extractor);
|
|
}
|
|
}
|
|
}
|