Skip to content

Commit 93d9469

Browse files
committed
Before -> BeforeClass to speed up tests
1 parent d70c079 commit 93d9469

24 files changed

Lines changed: 116 additions & 123 deletions

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3-
import org.junit.Before;
3+
import org.junit.BeforeClass;
44
import org.junit.Test;
55
import org.schabi.newpipe.Downloader;
66
import org.schabi.newpipe.extractor.ListExtractor;
@@ -16,10 +16,10 @@
1616

1717
public class SoundcloudChannelExtractorTest {
1818

19-
ChannelExtractor extractor;
19+
static ChannelExtractor extractor;
2020

21-
@Before
22-
public void setUp() throws Exception {
21+
@BeforeClass
22+
public static void setUp() throws Exception {
2323
NewPipe.init(Downloader.getInstance());
2424
extractor = SoundCloud.getService()
2525
.getChannelExtractor("https://soundcloud.com/liluzivert");

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import static org.junit.Assert.assertTrue;
77
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
88

9-
import org.junit.Before;
9+
import org.junit.BeforeClass;
1010
import org.junit.Ignore;
1111
import org.junit.Test;
1212
import org.schabi.newpipe.Downloader;
@@ -19,10 +19,10 @@
1919
*/
2020
public class SoundcloudChartsExtractorTest {
2121

22-
KioskExtractor extractor;
22+
static KioskExtractor extractor;
2323

24-
@Before
25-
public void setUp() throws Exception {
24+
@BeforeClass
25+
public static void setUp() throws Exception {
2626
NewPipe.init(Downloader.getInstance());
2727
extractor = SoundCloud.getService()
2828
.getKioskList()

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandlerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import static org.junit.Assert.assertEquals;
55
import static org.junit.Assert.assertTrue;
66

7-
import org.junit.Before;
7+
import org.junit.BeforeClass;
88
import org.junit.Test;
99
import org.schabi.newpipe.Downloader;
1010
import org.schabi.newpipe.extractor.NewPipe;
@@ -13,10 +13,10 @@
1313
* Test for {@link SoundcloudChartsUrlIdHandler}
1414
*/
1515
public class SoundcloudChartsUrlIdHandlerTest {
16-
private SoundcloudChartsUrlIdHandler urlIdHandler;
16+
private static SoundcloudChartsUrlIdHandler urlIdHandler;
1717

18-
@Before
19-
public void setUp() throws Exception {
18+
@BeforeClass
19+
public static void setUp() throws Exception {
2020
urlIdHandler = new SoundcloudChartsUrlIdHandler();
2121
NewPipe.init(Downloader.getInstance());
2222
}

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3-
import org.junit.Before;
3+
import org.junit.BeforeClass;
44
import org.junit.Test;
55
import org.schabi.newpipe.Downloader;
66
import org.schabi.newpipe.extractor.NewPipe;
@@ -15,10 +15,10 @@
1515
*/
1616

1717
public class SoundcloudPlaylistExtractorTest {
18-
private PlaylistExtractor extractor;
18+
private static PlaylistExtractor extractor;
1919

20-
@Before
21-
public void setUp() throws Exception {
20+
@BeforeClass
21+
public static void setUp() throws Exception {
2222
NewPipe.init(Downloader.getInstance());
2323
extractor = SoundCloud.getService()
2424
.getPlaylistExtractor("https://soundcloud.com/liluzivert/sets/the-perfect-luv-tape-r");

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchEngineAllTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3-
import org.junit.Before;
3+
import org.junit.BeforeClass;
44
import org.junit.Ignore;
55
import org.junit.Test;
66
import org.schabi.newpipe.Downloader;
@@ -17,10 +17,10 @@
1717
* Test for {@link SearchEngine}
1818
*/
1919
public class SoundcloudSearchEngineAllTest {
20-
private SearchResult result;
20+
private static SearchResult result;
2121

22-
@Before
23-
public void setUp() throws Exception {
22+
@BeforeClass
23+
public static void setUp() throws Exception {
2424
NewPipe.init(Downloader.getInstance());
2525
SearchEngine engine = SoundCloud.getService().getSearchEngine();
2626

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchEngineChannelTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3-
import org.junit.Before;
3+
import org.junit.BeforeClass;
44
import org.junit.Ignore;
55
import org.junit.Test;
66
import org.schabi.newpipe.Downloader;
@@ -16,10 +16,10 @@
1616
* Test for {@link SearchEngine}
1717
*/
1818
public class SoundcloudSearchEngineChannelTest {
19-
private SearchResult result;
19+
private static SearchResult result;
2020

21-
@Before
22-
public void setUp() throws Exception {
21+
@BeforeClass
22+
public static void setUp() throws Exception {
2323
NewPipe.init(Downloader.getInstance());
2424
SearchEngine engine = SoundCloud.getService().getSearchEngine();
2525

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchEnginePlaylistTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3-
import org.junit.Before;
3+
import org.junit.BeforeClass;
44
import org.junit.Ignore;
55
import org.junit.Test;
66
import org.schabi.newpipe.Downloader;
@@ -37,10 +37,10 @@
3737
* Test for {@link SearchEngine}
3838
*/
3939
public class SoundcloudSearchEnginePlaylistTest {
40-
private SearchResult result;
40+
private static SearchResult result;
4141

42-
@Before
43-
public void setUp() throws Exception {
42+
@BeforeClass
43+
public static void setUp() throws Exception {
4444
NewPipe.init(Downloader.getInstance());
4545
SearchEngine engine = SoundCloud.getService().getSearchEngine();
4646

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchEngineStreamTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3-
import org.junit.Before;
3+
import org.junit.BeforeClass;
44
import org.junit.Ignore;
55
import org.junit.Test;
66
import org.schabi.newpipe.Downloader;
@@ -16,10 +16,10 @@
1616
* Test for {@link SearchEngine}
1717
*/
1818
public class SoundcloudSearchEngineStreamTest {
19-
private SearchResult result;
19+
private static SearchResult result;
2020

21-
@Before
22-
public void setUp() throws Exception {
21+
@BeforeClass
22+
public static void setUp() throws Exception {
2323
NewPipe.init(Downloader.getInstance());
2424
SearchEngine engine = SoundCloud.getService().getSearchEngine();
2525

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractorDefaultTest.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3-
import com.grack.nanojson.JsonParserException;
4-
import org.junit.Before;
3+
import org.junit.BeforeClass;
54
import org.junit.Test;
65
import org.schabi.newpipe.Downloader;
76
import org.schabi.newpipe.extractor.NewPipe;
8-
import org.schabi.newpipe.extractor.Subtitles;
97
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
108
import org.schabi.newpipe.extractor.exceptions.ParsingException;
119
import org.schabi.newpipe.extractor.stream.StreamExtractor;
@@ -14,7 +12,6 @@
1412
import org.schabi.newpipe.extractor.stream.SubtitlesFormat;
1513

1614
import java.io.IOException;
17-
import java.util.List;
1815

1916
import static org.junit.Assert.*;
2017
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
@@ -23,10 +20,10 @@
2320
* Test for {@link StreamExtractor}
2421
*/
2522
public class SoundcloudStreamExtractorDefaultTest {
26-
private SoundcloudStreamExtractor extractor;
23+
private static SoundcloudStreamExtractor extractor;
2724

28-
@Before
29-
public void setUp() throws Exception {
25+
@BeforeClass
26+
public static void setUp() throws Exception {
3027
NewPipe.init(Downloader.getInstance());
3128
extractor = (SoundcloudStreamExtractor) SoundCloud.getService().getStreamExtractor("https://soundcloud.com/liluzivert/do-what-i-want-produced-by-maaly-raw-don-cannon");
3229
extractor.fetchPage();

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandlerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3-
import org.junit.Before;
3+
import org.junit.BeforeClass;
44
import org.junit.Test;
55
import org.schabi.newpipe.Downloader;
66
import org.schabi.newpipe.extractor.NewPipe;
@@ -15,10 +15,10 @@
1515
* Test for {@link SoundcloudStreamUrlIdHandler}
1616
*/
1717
public class SoundcloudStreamUrlIdHandlerTest {
18-
private SoundcloudStreamUrlIdHandler urlIdHandler;
18+
private static SoundcloudStreamUrlIdHandler urlIdHandler;
1919

20-
@Before
21-
public void setUp() throws Exception {
20+
@BeforeClass
21+
public static void setUp() throws Exception {
2222
urlIdHandler = SoundcloudStreamUrlIdHandler.getInstance();
2323
NewPipe.init(Downloader.getInstance());
2424
}

0 commit comments

Comments
 (0)