|
25 | 25 | import static org.junit.jupiter.api.Assertions.assertInstanceOf; |
26 | 26 | import static org.schabi.newpipe.extractor.ServiceList.YouTube; |
27 | 27 |
|
| 28 | +import org.jetbrains.annotations.NotNull; |
28 | 29 | import org.junit.jupiter.api.BeforeAll; |
29 | 30 | import org.junit.jupiter.api.Test; |
| 31 | +import org.schabi.newpipe.extractor.InitNewPipeTest; |
| 32 | +import org.schabi.newpipe.extractor.NewPipe; |
30 | 33 | import org.schabi.newpipe.extractor.StreamingService; |
| 34 | +import org.schabi.newpipe.extractor.downloader.Downloader; |
| 35 | +import org.schabi.newpipe.extractor.downloader.Request; |
| 36 | +import org.schabi.newpipe.extractor.downloader.Response; |
31 | 37 | import org.schabi.newpipe.extractor.kiosk.KioskList; |
32 | 38 | import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; |
33 | 39 | import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeMixPlaylistExtractor; |
|
36 | 42 | /** |
37 | 43 | * Test for {@link YoutubeService} |
38 | 44 | */ |
39 | | -public class YoutubeServiceTest implements InitYoutubeTest { |
40 | | - StreamingService service; |
41 | | - KioskList kioskList; |
| 45 | +public class YoutubeServiceTest { |
| 46 | + static StreamingService service; |
| 47 | + static KioskList kioskList; |
42 | 48 |
|
43 | | - @Override |
44 | 49 | @BeforeAll |
45 | | - public void setUp() throws Exception { |
46 | | - InitYoutubeTest.super.setUp(); |
| 50 | + public static void setUp() throws Exception { |
| 51 | + InitNewPipeTest.initEmpty(); |
| 52 | + // Init with dummy as |
| 53 | + // * a downloader is required otherwise a NPE is thrown during extract initialization |
| 54 | + // * nothing will be transmitted |
| 55 | + NewPipe.init(new Downloader() { |
| 56 | + @Override |
| 57 | + public Response execute(@NotNull final Request request) { |
| 58 | + throw new UnsupportedOperationException("No communication expected"); |
| 59 | + } |
| 60 | + }); |
47 | 61 | service = YouTube; |
48 | 62 | kioskList = service.getKioskList(); |
49 | 63 | } |
|
0 commit comments