Add bandcamp search suggestion extractor
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// Created by Fynn Godau 2019, licensed GNU GPL version 3 or later
|
||||
|
||||
package org.schabi.newpipe.extractor.services.bandcamp;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.DownloaderTestImpl;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampSuggestionExtractor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.bandcamp;
|
||||
|
||||
/**
|
||||
* Tests for {@link BandcampSuggestionExtractor}
|
||||
*/
|
||||
public class BandcampSuggestionExtractorTest {
|
||||
|
||||
private static BandcampSuggestionExtractor extractor;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() {
|
||||
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||
extractor = (BandcampSuggestionExtractor) bandcamp.getSuggestionExtractor();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchExample() throws IOException, ExtractionException {
|
||||
List<String> c418 = extractor.suggestionList("c418");
|
||||
|
||||
// When looking for c418, one should find C418
|
||||
assertTrue(c418.contains("C418"));
|
||||
|
||||
// There should be five results, but we can't be sure of that forever
|
||||
assertTrue(c418.size() > 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user