From 8f6c00f8d81d16de1b2f08a72452ebc5ad03c88c Mon Sep 17 00:00:00 2001 From: Fynn Godau Date: Thu, 4 Jun 2020 12:12:20 +0200 Subject: [PATCH] Use default test in BandcampSearchExtractorTest --- .../bandcamp/BandcampSearchExtractorTest.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java index a1b44b63b..532f27a53 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampSearchExtractorTest.java @@ -9,9 +9,11 @@ import org.schabi.newpipe.extractor.Extractor; import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.NewPipe; +import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.playlist.PlaylistInfoItem; import org.schabi.newpipe.extractor.search.SearchExtractor; +import org.schabi.newpipe.extractor.services.DefaultSearchExtractorTest; import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampChannelInfoItemExtractor; import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampPlaylistInfoItemExtractor; import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampSearchExtractor; @@ -19,6 +21,8 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem; import java.io.IOException; +import javax.annotation.Nullable; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp; @@ -28,8 +32,6 @@ import static org.schabi.newpipe.extractor.ServiceList.Bandcamp; */ public class BandcampSearchExtractorTest { - private static BandcampSearchExtractor extractor; - @BeforeClass public static void setUp() { NewPipe.init(DownloaderTestImpl.getInstance()); @@ -104,4 +106,25 @@ public class BandcampSearchExtractorTest { assertEquals("https://bandcamp.com/search?q=e&page=3", extractor.getPage(extractor.getNextPageUrl()).getNextPageUrl()); } + + public static class DefaultTest extends DefaultSearchExtractorTest { + private static SearchExtractor extractor; + private static final String QUERY = "test"; + + @BeforeClass + public static void setUp() throws Exception { + NewPipe.init(DownloaderTestImpl.getInstance()); + extractor = Bandcamp.getSearchExtractor(QUERY); + extractor.fetchPage(); + } + + @Override public SearchExtractor extractor() { return extractor; } + @Override public StreamingService expectedService() { return Bandcamp; } + @Override public String expectedName() { return QUERY; } + @Override public String expectedId() { return QUERY; } + @Override public String expectedUrlContains() { return "bandcamp.com/search?q=" + QUERY; } + @Override public String expectedOriginalUrlContains() { return "bandcamp.com/search?q=" + QUERY; } + @Override public String expectedSearchString() { return QUERY; } + @Nullable @Override public String expectedSearchSuggestion() { return null; } + } }