Rename some stuff

This commit is contained in:
wb9688
2017-08-07 18:12:51 +02:00
parent cfc2b9b3e2
commit c33ee3e409
41 changed files with 204 additions and 204 deletions

View File

@@ -8,7 +8,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
import static org.schabi.newpipe.extractor.NewPipe.getServiceByUrl;
public class NewPipeTest {
@@ -29,46 +29,46 @@ public class NewPipeTest {
@Test
public void getServiceWithId() throws Exception {
assertEquals(NewPipe.getService(Youtube.getId()), Youtube.getService());
assertEquals(NewPipe.getService(YouTube.getId()), YouTube.getService());
assertEquals(NewPipe.getService(SoundCloud.getId()), SoundCloud.getService());
assertNotEquals(NewPipe.getService(SoundCloud.getId()), Youtube.getService());
assertNotEquals(NewPipe.getService(SoundCloud.getId()), YouTube.getService());
}
@Test
public void getServiceWithName() throws Exception {
assertEquals(NewPipe.getService(Youtube.getServiceInfo().name), Youtube.getService());
assertEquals(NewPipe.getService(YouTube.getServiceInfo().name), YouTube.getService());
assertEquals(NewPipe.getService(SoundCloud.getServiceInfo().name), SoundCloud.getService());
assertNotEquals(NewPipe.getService(Youtube.getServiceInfo().name), SoundCloud.getService());
assertNotEquals(NewPipe.getService(YouTube.getServiceInfo().name), SoundCloud.getService());
}
@Test
public void getServiceWithUrl() throws Exception {
assertEquals(getServiceByUrl("https://www.youtube.com/watch?v=_r6CgaFNAGg"), Youtube.getService());
assertEquals(getServiceByUrl("https://www.youtube.com/channel/UCi2bIyFtz-JdI-ou8kaqsqg"), Youtube.getService());
assertEquals(getServiceByUrl("https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH"), Youtube.getService());
assertEquals(getServiceByUrl("https://www.youtube.com/watch?v=_r6CgaFNAGg"), YouTube.getService());
assertEquals(getServiceByUrl("https://www.youtube.com/channel/UCi2bIyFtz-JdI-ou8kaqsqg"), YouTube.getService());
assertEquals(getServiceByUrl("https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH"), YouTube.getService());
assertEquals(getServiceByUrl("https://soundcloud.com/shupemoosic/pegboard-nerds-try-this"), SoundCloud.getService());
assertEquals(getServiceByUrl("https://soundcloud.com/deluxe314/sets/pegboard-nerds"), SoundCloud.getService());
assertEquals(getServiceByUrl("https://soundcloud.com/pegboardnerds"), SoundCloud.getService());
assertNotEquals(getServiceByUrl("https://soundcloud.com/pegboardnerds"), Youtube.getService());
assertNotEquals(getServiceByUrl("https://soundcloud.com/pegboardnerds"), YouTube.getService());
assertNotEquals(getServiceByUrl("https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH"), SoundCloud.getService());
}
@Test
public void getIdWithServiceName() throws Exception {
assertEquals(NewPipe.getIdOfService(Youtube.getServiceInfo().name), Youtube.getId());
assertEquals(NewPipe.getIdOfService(YouTube.getServiceInfo().name), YouTube.getId());
assertEquals(NewPipe.getIdOfService(SoundCloud.getServiceInfo().name), SoundCloud.getId());
assertNotEquals(NewPipe.getIdOfService(SoundCloud.getServiceInfo().name), Youtube.getId());
assertNotEquals(NewPipe.getIdOfService(SoundCloud.getServiceInfo().name), YouTube.getId());
}
@Test
public void getServiceNameWithId() throws Exception {
assertEquals(NewPipe.getNameOfService(Youtube.getId()), Youtube.getServiceInfo().name);
assertEquals(NewPipe.getNameOfService(YouTube.getId()), YouTube.getServiceInfo().name);
assertEquals(NewPipe.getNameOfService(SoundCloud.getId()), SoundCloud.getServiceInfo().name);
assertNotEquals(NewPipe.getNameOfService(Youtube.getId()), SoundCloud.getServiceInfo().name);
assertNotEquals(NewPipe.getNameOfService(YouTube.getId()), SoundCloud.getServiceInfo().name);
}
}

View File

@@ -9,7 +9,7 @@ import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/**
* Test for {@link PlaylistExtractor}
@@ -21,7 +21,7 @@ public class YoutubePlaylistExtractorTest {
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
extractor = Youtube.getService()
extractor = YouTube.getService()
.getPlaylistExtractor("https://www.youtube.com/playlist?list=PL7XlqX4npddfrdpMCxBnNZXg2GFll7t5y");
}

View File

@@ -11,7 +11,7 @@ import java.util.EnumSet;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/*
@@ -43,12 +43,12 @@ public class YoutubeSearchEngineAllTest {
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
SearchEngine engine = Youtube.getService().getSearchEngine();
SearchEngine engine = YouTube.getService().getSearchEngine();
// Youtube will suggest "asdf" instead of "asdgff"
// keep in mind that the suggestions can change by country (the parameter "de")
result = engine.search("asdgff", 0, "de",
EnumSet.of(SearchEngine.Filter.CHANNEL,
EnumSet.of(SearchEngine.Filter.USER,
SearchEngine.Filter.STREAM)).getSearchResult();
}

View File

@@ -14,7 +14,7 @@ import java.util.EnumSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/*
@@ -46,7 +46,7 @@ public class YoutubeSearchEngineStreamTest {
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
SearchEngine engine = Youtube.getService().getSearchEngine();
SearchEngine engine = YouTube.getService().getSearchEngine();
// Youtube will suggest "results" instead of "rsults",
// keep in mind that the suggestions can change by country (the parameter "de")

View File

@@ -13,7 +13,7 @@ import java.util.EnumSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/*
@@ -39,18 +39,18 @@ import static org.schabi.newpipe.extractor.ServiceList.Youtube;
/**
* Test for {@link SearchEngine}
*/
public class YoutubeSearchEngineChannelTest {
public class YoutubeSearchEngineUserTest {
private SearchResult result;
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
SearchEngine engine = Youtube.getService().getSearchEngine();
SearchEngine engine = YouTube.getService().getSearchEngine();
// Youtube will suggest "gronkh" instead of "grrunkh"
// keep in mind that the suggestions can change by country (the parameter "de")
result = engine.search("grrunkh", 0, "de",
EnumSet.of(SearchEngine.Filter.CHANNEL)).getSearchResult();
EnumSet.of(SearchEngine.Filter.USER)).getSearchResult();
}
@Test
@@ -59,9 +59,9 @@ public class YoutubeSearchEngineChannelTest {
}
@Test
public void testChannelItemType() {
public void testUserItemType() {
for (InfoItem infoItem : result.resultList) {
assertEquals(InfoItem.InfoType.CHANNEL, infoItem.info_type);
assertEquals(InfoItem.InfoType.USER, infoItem.info_type);
}
}

View File

@@ -15,7 +15,7 @@ import java.io.IOException;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/*
* Created by Christian Schabesberger on 30.12.15.
@@ -47,7 +47,7 @@ public class YoutubeStreamExtractorDefaultTest {
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
extractor = Youtube.getService().getStreamExtractor("https://www.youtube.com/watch?v=YQHsXMglC9A");
extractor = YouTube.getService().getStreamExtractor("https://www.youtube.com/watch?v=YQHsXMglC9A");
}
@Test
@@ -58,7 +58,7 @@ public class YoutubeStreamExtractorDefaultTest {
@Test
public void testGetValidTimeStamp() throws IOException, ExtractionException {
StreamExtractor extractor = Youtube.getService().getStreamExtractor("https://youtu.be/FmG385_uUys?t=174");
StreamExtractor extractor = YouTube.getService().getStreamExtractor("https://youtu.be/FmG385_uUys?t=174");
assertTrue(Integer.toString(extractor.getTimeStamp()),
extractor.getTimeStamp() == 174);
}
@@ -95,8 +95,8 @@ public class YoutubeStreamExtractorDefaultTest {
}
@Test
public void testGetChannelUrl() throws ParsingException {
assertTrue(extractor.getChannelUrl().length() > 0);
public void testGetUserlUrl() throws ParsingException {
assertTrue(extractor.getUserUrl().length() > 0);
}
@Test

View File

@@ -9,7 +9,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import java.io.IOException;
import static org.junit.Assert.fail;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/*
* Created by Christian Schabesberger on 30.12.15.
@@ -43,7 +43,7 @@ public class YoutubeStreamExtractorGemaTest {
public void testGemaError() throws IOException, ExtractionException {
try {
NewPipe.init(Downloader.getInstance());
Youtube.getService().getStreamExtractor("https://www.youtube.com/watch?v=3O1_3zBUKM8");
YouTube.getService().getStreamExtractor("https://www.youtube.com/watch?v=3O1_3zBUKM8");
fail("GemaException should be thrown");
} catch (YoutubeStreamExtractor.GemaException ignored) {

View File

@@ -12,7 +12,7 @@ import org.schabi.newpipe.extractor.stream.VideoStream;
import java.io.IOException;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/**
* Test for {@link YoutubeStreamUrlIdHandler}
@@ -24,7 +24,7 @@ public class YoutubeStreamExtractorRestrictedTest {
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
extractor = Youtube.getService()
extractor = YouTube.getService()
.getStreamExtractor("https://www.youtube.com/watch?v=i6JTvzrpBy0");
}
@@ -36,7 +36,7 @@ public class YoutubeStreamExtractorRestrictedTest {
@Test
public void testGetValidTimeStamp() throws IOException, ExtractionException {
StreamExtractor extractor= Youtube.getService()
StreamExtractor extractor= YouTube.getService()
.getStreamExtractor("https://youtu.be/FmG385_uUys?t=174");
assertTrue(Integer.toString(extractor.getTimeStamp()),
extractor.getTimeStamp() == 174);

View File

@@ -10,7 +10,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import java.io.IOException;
import static org.junit.Assert.assertFalse;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/*
* Created by Christian Schabesberger on 18.11.16.
@@ -41,7 +41,7 @@ public class YoutubeSuggestionExtractorTest {
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
suggestionExtractor = Youtube.getService().getSuggestionExtractor();
suggestionExtractor = YouTube.getService().getSuggestionExtractor();
}
@Test

View File

@@ -4,12 +4,12 @@ import org.junit.Before;
import org.junit.Test;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
import org.schabi.newpipe.extractor.user.UserExtractor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.Youtube;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
/*
* Created by Christian Schabesberger on 12.09.16.
@@ -32,18 +32,18 @@ import static org.schabi.newpipe.extractor.ServiceList.Youtube;
*/
/**
* Test for {@link ChannelExtractor}
* Test for {@link UserExtractor}
*/
public class YoutubeChannelExtractorTest {
public class YoutubeUserExtractorTest {
ChannelExtractor extractor;
UserExtractor extractor;
@Before
public void setUp() throws Exception {
NewPipe.init(Downloader.getInstance());
extractor = Youtube.getService()
.getChannelExtractor("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw");
extractor = YouTube.getService()
.getUserExtractor("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw");
}
@Test
@@ -52,8 +52,8 @@ public class YoutubeChannelExtractorTest {
}
@Test
public void testGetChannelName() throws Exception {
assertEquals(extractor.getChannelName(), "Gronkh");
public void testGetUserName() throws Exception {
assertEquals(extractor.getUserName(), "Gronkh");
}
@Test