Skip to content

Commit f69b0ff

Browse files
committed
Remove unused methods
1 parent 23fa31a commit f69b0ff

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

extractor/src/main/java/org/schabi/newpipe/extractor/NewPipe.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
import org.schabi.newpipe.extractor.localization.ContentCountry;
2626
import org.schabi.newpipe.extractor.localization.Localization;
2727

28+
import java.util.List;
29+
2830
import javax.annotation.Nonnull;
2931
import javax.annotation.Nullable;
30-
import java.util.List;
3132

3233
/**
3334
* Provides access to streaming services supported by NewPipe.
@@ -92,14 +93,6 @@ public static StreamingService getServiceByUrl(final String url) throws Extracti
9293
throw new ExtractionException("No service can handle the url = \"" + url + "\"");
9394
}
9495

95-
public static int getIdOfService(final String serviceName) {
96-
try {
97-
return getService(serviceName).getServiceId();
98-
} catch (final ExtractionException ignored) {
99-
return -1;
100-
}
101-
}
102-
10396
public static String getNameOfService(final int id) {
10497
try {
10598
return getService(id).getServiceInfo().getName();

extractor/src/test/java/org/schabi/newpipe/extractor/NewPipeTest.java

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package org.schabi.newpipe.extractor;
22

3-
import org.junit.jupiter.api.Test;
4-
5-
import java.util.HashSet;
6-
7-
import static org.junit.jupiter.api.Assertions.*;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
85
import static org.schabi.newpipe.extractor.NewPipe.getServiceByUrl;
96
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
107
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
118

9+
import org.junit.jupiter.api.Test;
10+
11+
import java.util.HashSet;
12+
1213
public class NewPipeTest {
1314
@Test
1415
public void getAllServicesTest() throws Exception {
@@ -17,8 +18,8 @@ public void getAllServicesTest() throws Exception {
1718

1819
@Test
1920
public void testAllServicesHaveDifferentId() throws Exception {
20-
HashSet<Integer> servicesId = new HashSet<>();
21-
for (StreamingService streamingService : NewPipe.getServices()) {
21+
final HashSet<Integer> servicesId = new HashSet<>();
22+
for (final StreamingService streamingService : NewPipe.getServices()) {
2223
final String errorMsg =
2324
"There are services with the same id = " + streamingService.getServiceId()
2425
+ " (current service > " + streamingService.getServiceInfo().getName() + ")";
@@ -32,11 +33,6 @@ public void getServiceWithId() throws Exception {
3233
assertEquals(NewPipe.getService(YouTube.getServiceId()), YouTube);
3334
}
3435

35-
@Test
36-
public void getServiceWithName() throws Exception {
37-
assertEquals(NewPipe.getService(YouTube.getServiceInfo().getName()), YouTube);
38-
}
39-
4036
@Test
4137
public void getServiceWithUrl() throws Exception {
4238
assertEquals(getServiceByUrl("https://www.youtube.com/watch?v=_r6CgaFNAGg"), YouTube);
@@ -48,11 +44,6 @@ public void getServiceWithUrl() throws Exception {
4844
assertEquals(getServiceByUrl("https://www.google.com/url?sa=t&url=https%3A%2F%2Fsoundcloud.com%2Fciaoproduction&rct=j&q=&esrc=s&source=web&cd="), SoundCloud);
4945
}
5046

51-
@Test
52-
public void getIdWithServiceName() throws Exception {
53-
assertEquals(NewPipe.getIdOfService(YouTube.getServiceInfo().getName()), YouTube.getServiceId());
54-
}
55-
5647
@Test
5748
public void getServiceNameWithId() throws Exception {
5849
assertEquals(NewPipe.getNameOfService(YouTube.getServiceId()), YouTube.getServiceInfo().getName());

0 commit comments

Comments
 (0)