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

126 lines
4.2 KiB
Java
Raw Normal View History

package org.schabi.newpipe.extractor.services.soundcloud;
2021-12-27 21:08:08 +01:00
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.schabi.newpipe.downloader.DownloaderTestImpl;
import org.schabi.newpipe.extractor.NewPipe;
2020-02-27 04:09:09 +01:00
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.services.BaseListExtractorTest;
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChartsExtractor;
2021-12-27 21:08:08 +01:00
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
2020-02-27 04:09:09 +01:00
import static org.schabi.newpipe.extractor.services.DefaultTests.*;
public class SoundcloudChartsExtractorTest {
2020-02-27 04:09:09 +01:00
public static class NewAndHot implements BaseListExtractorTest {
private static SoundcloudChartsExtractor extractor;
2021-12-27 21:08:08 +01:00
@BeforeAll
2020-02-27 04:09:09 +01:00
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (SoundcloudChartsExtractor) SoundCloud.getKioskList()
.getExtractorById("New & hot", null);
extractor.fetchPage();
}
2020-02-27 04:09:09 +01:00
/*//////////////////////////////////////////////////////////////////////////
// Extractor
//////////////////////////////////////////////////////////////////////////*/
2020-02-27 04:09:09 +01:00
@Test
public void testServiceId() {
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
}
2020-02-27 04:09:09 +01:00
@Test
public void testName() {
assertEquals("New & hot", extractor.getName());
}
2020-02-27 04:09:09 +01:00
@Test
public void testId() {
assertEquals("New & hot", extractor.getId());
}
2020-02-27 04:09:09 +01:00
@Test
public void testUrl() throws ParsingException {
assertEquals("https://soundcloud.com/charts/new", extractor.getUrl());
}
2020-02-27 04:09:09 +01:00
@Test
public void testOriginalUrl() throws ParsingException {
assertEquals("https://soundcloud.com/charts/new", extractor.getOriginalUrl());
}
2020-02-27 04:09:09 +01:00
/*//////////////////////////////////////////////////////////////////////////
// ListExtractor
//////////////////////////////////////////////////////////////////////////*/
2020-02-27 04:09:09 +01:00
@Test
public void testRelatedItems() throws Exception {
defaultTestRelatedItems(extractor);
}
2020-02-27 04:09:09 +01:00
@Test
public void testMoreRelatedItems() throws Exception {
defaultTestMoreItems(extractor);
}
}
2020-02-27 04:09:09 +01:00
public static class Top50Charts implements BaseListExtractorTest {
private static SoundcloudChartsExtractor extractor;
2021-12-27 21:08:08 +01:00
@BeforeAll
2020-02-27 04:09:09 +01:00
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (SoundcloudChartsExtractor) SoundCloud.getKioskList()
.getExtractorById("Top 50", null);
extractor.fetchPage();
}
/*//////////////////////////////////////////////////////////////////////////
// Extractor
//////////////////////////////////////////////////////////////////////////*/
@Test
public void testServiceId() {
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
}
@Test
public void testName() {
assertEquals("Top 50", extractor.getName());
}
@Test
public void testId() {
assertEquals("Top 50", extractor.getId());
}
@Test
public void testUrl() throws ParsingException {
assertEquals("https://soundcloud.com/charts/top", extractor.getUrl());
}
@Test
public void testOriginalUrl() throws ParsingException {
assertEquals("https://soundcloud.com/charts/top", extractor.getOriginalUrl());
}
/*//////////////////////////////////////////////////////////////////////////
// ListExtractor
//////////////////////////////////////////////////////////////////////////*/
@Test
public void testRelatedItems() throws Exception {
defaultTestRelatedItems(extractor);
}
@Test
public void testMoreRelatedItems() throws Exception {
defaultTestMoreItems(extractor);
}
}
}