Skip to content

Commit f775155

Browse files
authored
Merge pull request #846 from litetex/remove-unused-methods
Remove unused methods
2 parents 9d625dd + 2015eb3 commit f775155

File tree

2 files changed

+10
-41
lines changed

2 files changed

+10
-41
lines changed

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

Lines changed: 2 additions & 19 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,24 +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-
103-
public static String getNameOfService(final int id) {
104-
try {
105-
return getService(id).getServiceInfo().getName();
106-
} catch (final Exception e) {
107-
System.err.println("Service id not known");
108-
e.printStackTrace();
109-
return "<unknown>";
110-
}
111-
}
112-
11396
/*//////////////////////////////////////////////////////////////////////////
11497
// Localization
11598
//////////////////////////////////////////////////////////////////////////*/
Lines changed: 8 additions & 22 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);
@@ -47,14 +43,4 @@ public void getServiceWithUrl() throws Exception {
4743
assertEquals(getServiceByUrl("https://soundcloud.com/pegboardnerds"), SoundCloud);
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
}
50-
51-
@Test
52-
public void getIdWithServiceName() throws Exception {
53-
assertEquals(NewPipe.getIdOfService(YouTube.getServiceInfo().getName()), YouTube.getServiceId());
54-
}
55-
56-
@Test
57-
public void getServiceNameWithId() throws Exception {
58-
assertEquals(NewPipe.getNameOfService(YouTube.getServiceId()), YouTube.getServiceInfo().getName());
59-
}
6046
}

0 commit comments

Comments
 (0)