NewPipeExtractor/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampChannelTabExtractor...

126 lines
4.1 KiB
Java
Raw Normal View History

2022-10-25 21:13:16 +02:00
package org.schabi.newpipe.extractor.services.bandcamp;
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.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.bandcamp.extractors.BandcampChannelTabExtractor;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestRelatedItems;
public class BandcampChannelTabExtractorTest {
public static class Tracks implements BaseListExtractorTest {
private static BandcampChannelTabExtractor extractor;
@BeforeAll
public static void setUp() throws IOException, ExtractionException {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (BandcampChannelTabExtractor) Bandcamp
.getChannelTabExtractorFromId("2464198920", ChannelTabs.TRACKS);
extractor.fetchPage();
}
@Test
@Override
public void testServiceId() throws Exception {
assertEquals(Bandcamp.getServiceId(), extractor.getServiceId());
}
@Test
@Override
public void testName() throws Exception {
assertEquals(ChannelTabs.TRACKS, extractor.getName());
}
@Test
@Override
public void testId() throws ParsingException {
assertEquals("2464198920", extractor.getId());
}
@Test
@Override
public void testUrl() throws ParsingException {
assertEquals("https://wintergatan.bandcamp.com/track", extractor.getUrl());
}
@Test
@Override
public void testOriginalUrl() throws Exception {
assertEquals("https://wintergatan.bandcamp.com/track", extractor.getOriginalUrl());
}
@Test
@Override
public void testRelatedItems() throws Exception {
defaultTestRelatedItems(extractor);
}
@Override
public void testMoreRelatedItems() throws Exception {
// Bandcamp only returns a single page
}
}
public static class Albums implements BaseListExtractorTest {
2022-10-25 21:13:16 +02:00
private static BandcampChannelTabExtractor extractor;
@BeforeAll
public static void setUp() throws IOException, ExtractionException {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (BandcampChannelTabExtractor) Bandcamp
2022-11-04 23:47:44 +01:00
.getChannelTabExtractorFromId("2450875064", 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(Bandcamp.getServiceId(), extractor.getServiceId());
}
@Test
@Override
public void testName() throws Exception {
assertEquals(ChannelTabs.ALBUMS, extractor.getName());
}
2022-10-25 21:13:16 +02:00
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testId() throws ParsingException {
assertEquals("2450875064", extractor.getId());
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testUrl() throws ParsingException {
assertEquals("https://toupie.bandcamp.com/album", extractor.getUrl());
}
@Test
@Override
public void testOriginalUrl() throws Exception {
assertEquals("https://toupie.bandcamp.com/album", extractor.getOriginalUrl());
}
@Test
@Override
2022-10-25 21:13:16 +02:00
public void testRelatedItems() throws Exception {
defaultTestRelatedItems(extractor);
}
@Override
public void testMoreRelatedItems() throws Exception {
// Bandcamp only returns a single page
}
2022-10-25 21:13:16 +02:00
}
}