2019-12-22 02:55:54 +01:00
|
|
|
// Created by Fynn Godau 2019, licensed GNU GPL version 3 or later
|
|
|
|
|
|
|
|
package org.schabi.newpipe.extractor.services.bandcamp;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
import org.junit.jupiter.api.BeforeAll;
|
|
|
|
import org.junit.jupiter.api.Test;
|
2021-01-15 21:55:40 +01:00
|
|
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
2019-12-22 02:55:54 +01:00
|
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
|
|
import org.schabi.newpipe.extractor.services.bandcamp.linkHandler.BandcampPlaylistLinkHandlerFactory;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
2019-12-22 02:55:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for {@link BandcampPlaylistLinkHandlerFactory}
|
|
|
|
*/
|
|
|
|
public class BandcampPlaylistLinkHandlerFactoryTest {
|
|
|
|
|
|
|
|
private static BandcampPlaylistLinkHandlerFactory linkHandler;
|
|
|
|
|
2021-12-27 21:08:08 +01:00
|
|
|
@BeforeAll
|
2019-12-22 02:55:54 +01:00
|
|
|
public static void setUp() {
|
|
|
|
linkHandler = new BandcampPlaylistLinkHandlerFactory();
|
|
|
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testAcceptUrl() throws ParsingException {
|
|
|
|
assertFalse(linkHandler.acceptUrl("http://interovgm.com/releases/"));
|
|
|
|
assertFalse(linkHandler.acceptUrl("https://interovgm.com/releases"));
|
|
|
|
assertFalse(linkHandler.acceptUrl("http://zachbenson.bandcamp.com"));
|
|
|
|
assertFalse(linkHandler.acceptUrl("https://bandcamp.com"));
|
|
|
|
assertFalse(linkHandler.acceptUrl("https://zachbenson.bandcamp.com/"));
|
|
|
|
assertFalse(linkHandler.acceptUrl("https://zachbenson.bandcamp.com/track/kitchen"));
|
|
|
|
assertFalse(linkHandler.acceptUrl("https://interovgm.com/track/title"));
|
2020-12-05 15:08:26 +01:00
|
|
|
assertFalse(linkHandler.acceptUrl("https://example.com/album/samplealbum"));
|
2019-12-22 02:55:54 +01:00
|
|
|
|
|
|
|
assertTrue(linkHandler.acceptUrl("https://powertothequeerkids.bandcamp.com/album/power-to-the-queer-kids"));
|
|
|
|
assertTrue(linkHandler.acceptUrl("https://zachbenson.bandcamp.com/album/prom"));
|
2020-05-25 19:17:27 +02:00
|
|
|
assertTrue(linkHandler.acceptUrl("https://MACBENSON.BANDCAMP.COM/ALBUM/COMING-OF-AGE"));
|
2019-12-22 02:55:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|