Skip to content

Commit 5a3f458

Browse files
[SoundCloud] Fix failing tests in SoundcloudChannelTabExtractorTest
Use @nested and TestInstance.Lifecycle.PER_CLASS to remove warnings
1 parent a4bacd0 commit 5a3f458

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed
Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

33
import org.junit.jupiter.api.BeforeAll;
4+
import org.junit.jupiter.api.Nested;
45
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.api.TestInstance;
57
import org.schabi.newpipe.downloader.DownloaderTestImpl;
68
import org.schabi.newpipe.extractor.InfoItem;
79
import org.schabi.newpipe.extractor.NewPipe;
810
import org.schabi.newpipe.extractor.StreamingService;
911
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabExtractor;
1012
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs;
1113
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
12-
import org.schabi.newpipe.extractor.exceptions.ParsingException;
13-
import org.schabi.newpipe.extractor.services.BaseListExtractorTest;
1414
import org.schabi.newpipe.extractor.services.DefaultListExtractorTest;
1515
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelTabExtractor;
1616

1717
import java.io.IOException;
1818

19-
import static org.junit.jupiter.api.Assertions.assertEquals;
20-
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
2119
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
2220
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor;
23-
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestMoreItems;
24-
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestRelatedItems;
2521

2622
class SoundcloudChannelTabExtractorTest {
2723

28-
static class Tracks extends DefaultListExtractorTest<ChannelTabExtractor> {
29-
private static SoundcloudChannelTabExtractor extractor;
24+
@Nested
25+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
26+
class Tracks extends DefaultListExtractorTest<ChannelTabExtractor> {
27+
private SoundcloudChannelTabExtractor extractor;
3028

3129
@BeforeAll
32-
static void setUp() throws IOException, ExtractionException {
30+
void setUp() throws IOException, ExtractionException {
3331
NewPipe.init(DownloaderTestImpl.getInstance());
3432
extractor = (SoundcloudChannelTabExtractor) SoundCloud
3533
.getChannelTabExtractorFromId("10494998", ChannelTabs.TRACKS);
@@ -43,7 +41,6 @@ static void setUp() throws IOException, ExtractionException {
4341
@Override public String expectedUrlContains() throws Exception { return "https://soundcloud.com/liluzivert/tracks"; }
4442
@Override public String expectedOriginalUrlContains() throws Exception { return "https://soundcloud.com/liluzivert/tracks"; }
4543
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
46-
@Override public boolean expectedHasMoreItems() { return true; }
4744

4845
@Test
4946
void testGetPageInNewExtractor() throws Exception {
@@ -53,11 +50,13 @@ void testGetPageInNewExtractor() throws Exception {
5350
}
5451
}
5552

56-
static class Playlists extends DefaultListExtractorTest<ChannelTabExtractor> {
57-
private static SoundcloudChannelTabExtractor extractor;
53+
@Nested
54+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
55+
class Playlists extends DefaultListExtractorTest<ChannelTabExtractor> {
56+
private SoundcloudChannelTabExtractor extractor;
5857

5958
@BeforeAll
60-
static void setUp() throws IOException, ExtractionException {
59+
void setUp() throws IOException, ExtractionException {
6160
NewPipe.init(DownloaderTestImpl.getInstance());
6261
extractor = (SoundcloudChannelTabExtractor) SoundCloud
6362
.getChannelTabExtractorFromId("323371733", ChannelTabs.PLAYLISTS);
@@ -68,17 +67,18 @@ static void setUp() throws IOException, ExtractionException {
6867
@Override public StreamingService expectedService() throws Exception { return SoundCloud; }
6968
@Override public String expectedName() throws Exception { return ChannelTabs.PLAYLISTS; }
7069
@Override public String expectedId() throws Exception { return "323371733"; }
71-
@Override public String expectedUrlContains() throws Exception { return "https://soundcloud.com/trackaholic/sets"; }
72-
@Override public String expectedOriginalUrlContains() throws Exception { return "https://soundcloud.com/trackaholic/sets"; }
70+
@Override public String expectedUrlContains() throws Exception { return "https://soundcloud.com/prodbypheelix/sets"; }
71+
@Override public String expectedOriginalUrlContains() throws Exception { return "https://soundcloud.com/prodbypheelix/sets"; }
7372
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.PLAYLIST; }
74-
@Override public boolean expectedHasMoreItems() { return true; }
7573
}
7674

77-
static class Albums extends DefaultListExtractorTest<ChannelTabExtractor> {
78-
private static SoundcloudChannelTabExtractor extractor;
75+
@Nested
76+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
77+
class Albums extends DefaultListExtractorTest<ChannelTabExtractor> {
78+
private SoundcloudChannelTabExtractor extractor;
7979

8080
@BeforeAll
81-
static void setUp() throws IOException, ExtractionException {
81+
void setUp() throws IOException, ExtractionException {
8282
NewPipe.init(DownloaderTestImpl.getInstance());
8383
extractor = (SoundcloudChannelTabExtractor) SoundCloud
8484
.getChannelTabExtractorFromId("4803918", ChannelTabs.ALBUMS);
@@ -92,6 +92,5 @@ static void setUp() throws IOException, ExtractionException {
9292
@Override public String expectedUrlContains() throws Exception { return "https://soundcloud.com/bigsean-1/albums"; }
9393
@Override public String expectedOriginalUrlContains() throws Exception { return "https://soundcloud.com/bigsean-1/albums"; }
9494
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.PLAYLIST; }
95-
@Override public boolean expectedHasMoreItems() { return true; }
9695
}
9796
}

0 commit comments

Comments
 (0)