[Bandcamp] Tests - Add finals and improve code formatting
This commit is contained in:
parent
99e7ef013e
commit
c91e21b37c
|
@ -36,13 +36,13 @@ public class BandcampFeaturedExtractorTest implements BaseListExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFeaturedCount() throws ExtractionException, IOException {
|
public void testFeaturedCount() throws ExtractionException, IOException {
|
||||||
List<PlaylistInfoItem> list = extractor.getInitialPage().getItems();
|
final List<PlaylistInfoItem> list = extractor.getInitialPage().getItems();
|
||||||
assertTrue(list.size() > 1);
|
assertTrue(list.size() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHttps() throws ExtractionException, IOException {
|
public void testHttps() throws ExtractionException, IOException {
|
||||||
List<PlaylistInfoItem> list = extractor.getInitialPage().getItems();
|
final List<PlaylistInfoItem> list = extractor.getInitialPage().getItems();
|
||||||
assertTrue(list.get(0).getUrl().contains("https://"));
|
assertTrue(list.get(0).getUrl().contains("https://"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class BandcampPlaylistExtractorTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCount() throws ExtractionException, IOException {
|
public void testCount() throws ExtractionException, IOException {
|
||||||
PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://macbenson.bandcamp.com/album/coming-of-age");
|
final PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://macbenson.bandcamp.com/album/coming-of-age");
|
||||||
extractor.fetchPage();
|
extractor.fetchPage();
|
||||||
|
|
||||||
assertEquals(5, extractor.getStreamCount());
|
assertEquals(5, extractor.getStreamCount());
|
||||||
|
@ -47,10 +47,10 @@ public class BandcampPlaylistExtractorTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDifferentTrackCovers() throws ExtractionException, IOException {
|
public void testDifferentTrackCovers() throws ExtractionException, IOException {
|
||||||
PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://zachbensonarchive.bandcamp.com/album/results-of-boredom");
|
final PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://zachbensonarchive.bandcamp.com/album/results-of-boredom");
|
||||||
extractor.fetchPage();
|
extractor.fetchPage();
|
||||||
|
|
||||||
List<StreamInfoItem> l = extractor.getInitialPage().getItems();
|
final List<StreamInfoItem> l = extractor.getInitialPage().getItems();
|
||||||
assertEquals(extractor.getThumbnailUrl(), l.get(0).getThumbnailUrl());
|
assertEquals(extractor.getThumbnailUrl(), l.get(0).getThumbnailUrl());
|
||||||
assertNotEquals(extractor.getThumbnailUrl(), l.get(5).getThumbnailUrl());
|
assertNotEquals(extractor.getThumbnailUrl(), l.get(5).getThumbnailUrl());
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,13 @@ public class BandcampPlaylistExtractorTest {
|
||||||
*/
|
*/
|
||||||
@Test(timeout = 10000L)
|
@Test(timeout = 10000L)
|
||||||
public void testDifferentTrackCoversDuration() throws ExtractionException, IOException {
|
public void testDifferentTrackCoversDuration() throws ExtractionException, IOException {
|
||||||
PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://infiniteammo.bandcamp.com/album/night-in-the-woods-vol-1-at-the-end-of-everything");
|
final PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://infiniteammo.bandcamp.com/album/night-in-the-woods-vol-1-at-the-end-of-everything");
|
||||||
extractor.fetchPage();
|
extractor.fetchPage();
|
||||||
|
|
||||||
/* All tracks in this album have the same cover art, but I don't know any albums with more than 10 tracks
|
/* All tracks in this album have the same cover art, but I don't know any albums with more than 10 tracks
|
||||||
* that has at least one track with a cover art different from the rest.
|
* that has at least one track with a cover art different from the rest.
|
||||||
*/
|
*/
|
||||||
List<StreamInfoItem> l = extractor.getInitialPage().getItems();
|
final List<StreamInfoItem> l = extractor.getInitialPage().getItems();
|
||||||
assertEquals(extractor.getThumbnailUrl(), l.get(0).getThumbnailUrl());
|
assertEquals(extractor.getThumbnailUrl(), l.get(0).getThumbnailUrl());
|
||||||
assertEquals(extractor.getThumbnailUrl(), l.get(5).getThumbnailUrl());
|
assertEquals(extractor.getThumbnailUrl(), l.get(5).getThumbnailUrl());
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public class BandcampPlaylistExtractorTest {
|
||||||
*/
|
*/
|
||||||
@Test(expected = ContentNotAvailableException.class)
|
@Test(expected = ContentNotAvailableException.class)
|
||||||
public void testLockedContent() throws ExtractionException, IOException {
|
public void testLockedContent() throws ExtractionException, IOException {
|
||||||
PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://billwurtz.bandcamp.com/album/high-enough");
|
final PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://billwurtz.bandcamp.com/album/high-enough");
|
||||||
extractor.fetchPage();
|
extractor.fetchPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class BandcampPlaylistExtractorTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSingleStreamPlaylist() throws ExtractionException, IOException {
|
public void testSingleStreamPlaylist() throws ExtractionException, IOException {
|
||||||
PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://zachjohnson1.bandcamp.com/album/endless");
|
final PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://zachjohnson1.bandcamp.com/album/endless");
|
||||||
extractor.fetchPage();
|
extractor.fetchPage();
|
||||||
|
|
||||||
assertEquals(1, extractor.getStreamCount());
|
assertEquals(1, extractor.getStreamCount());
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class BandcampRadioExtractorTest implements BaseListExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRadioCount() throws ExtractionException, IOException {
|
public void testRadioCount() throws ExtractionException, IOException {
|
||||||
List<InfoItem> list = Bandcamp.getKioskList().getExtractorById("Radio", null).getInitialPage().getItems();
|
final List<InfoItem> list = Bandcamp.getKioskList().getExtractorById("Radio", null).getInitialPage().getItems();
|
||||||
assertTrue(list.size() > 300);
|
assertTrue(list.size() > 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,8 @@ public class BandcampRadioStreamExtractorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testGettingCorrectStreamExtractor() throws ExtractionException {
|
public void testGettingCorrectStreamExtractor() throws ExtractionException {
|
||||||
assertTrue(Bandcamp.getStreamExtractor("https://bandcamp.com/?show=3") instanceof BandcampRadioStreamExtractor);
|
assertTrue(Bandcamp.getStreamExtractor("https://bandcamp.com/?show=3") instanceof BandcampRadioStreamExtractor);
|
||||||
assertFalse(Bandcamp.getStreamExtractor("https://zachbenson.bandcamp.com/track/deflated") instanceof BandcampRadioStreamExtractor);
|
assertFalse(Bandcamp.getStreamExtractor("https://zachbenson.bandcamp.com/track/deflated")
|
||||||
|
instanceof BandcampRadioStreamExtractor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -86,7 +87,8 @@ public class BandcampRadioStreamExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetDescription() throws ParsingException {
|
public void testGetDescription() throws ParsingException {
|
||||||
assertEquals("Featuring special guests Nick Hakim and Elbows, plus fresh cuts from Eddie Palmieri, KRS One, Ladi6, and Moonchild.", e.getDescription().getContent());
|
assertEquals("Featuring special guests Nick Hakim and Elbows, plus fresh cuts from Eddie Palmieri, KRS One, Ladi6, and Moonchild.",
|
||||||
|
e.getDescription().getContent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,10 @@ public class BandcampSearchExtractorTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStreamSearch() throws ExtractionException, IOException {
|
public void testStreamSearch() throws ExtractionException, IOException {
|
||||||
SearchExtractor extractor = Bandcamp.getSearchExtractor("best friend's basement");
|
final SearchExtractor extractor = Bandcamp.getSearchExtractor("best friend's basement");
|
||||||
|
|
||||||
ListExtractor.InfoItemsPage<InfoItem> page = extractor.getInitialPage();
|
final ListExtractor.InfoItemsPage<InfoItem> page = extractor.getInitialPage();
|
||||||
StreamInfoItem bestFriendsBasement = (StreamInfoItem) page.getItems().get(0);
|
final StreamInfoItem bestFriendsBasement = (StreamInfoItem) page.getItems().get(0);
|
||||||
|
|
||||||
// The track by Zach Benson should be the first result, no?
|
// The track by Zach Benson should be the first result, no?
|
||||||
assertEquals("Best Friend's Basement", bestFriendsBasement.getName());
|
assertEquals("Best Friend's Basement", bestFriendsBasement.getName());
|
||||||
|
@ -58,8 +58,8 @@ public class BandcampSearchExtractorTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testChannelSearch() throws ExtractionException, IOException {
|
public void testChannelSearch() throws ExtractionException, IOException {
|
||||||
SearchExtractor extractor = Bandcamp.getSearchExtractor("C418");
|
final SearchExtractor extractor = Bandcamp.getSearchExtractor("C418");
|
||||||
InfoItem c418 = extractor.getInitialPage()
|
final InfoItem c418 = extractor.getInitialPage()
|
||||||
.getItems().get(0);
|
.getItems().get(0);
|
||||||
|
|
||||||
// C418's artist profile should be the first result, no?
|
// C418's artist profile should be the first result, no?
|
||||||
|
@ -75,7 +75,7 @@ public class BandcampSearchExtractorTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAlbumSearch() throws ExtractionException, IOException {
|
public void testAlbumSearch() throws ExtractionException, IOException {
|
||||||
SearchExtractor extractor = Bandcamp.getSearchExtractor("minecraft volume alpha");
|
final SearchExtractor extractor = Bandcamp.getSearchExtractor("minecraft volume alpha");
|
||||||
InfoItem minecraft = extractor.getInitialPage()
|
InfoItem minecraft = extractor.getInitialPage()
|
||||||
.getItems().get(0);
|
.getItems().get(0);
|
||||||
|
|
||||||
|
@ -96,12 +96,12 @@ public class BandcampSearchExtractorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testMultiplePages() throws ExtractionException, IOException {
|
public void testMultiplePages() throws ExtractionException, IOException {
|
||||||
// A query practically guaranteed to have the maximum amount of pages
|
// A query practically guaranteed to have the maximum amount of pages
|
||||||
SearchExtractor extractor = Bandcamp.getSearchExtractor("e");
|
final SearchExtractor extractor = Bandcamp.getSearchExtractor("e");
|
||||||
|
|
||||||
Page page2 = extractor.getInitialPage().getNextPage();
|
final Page page2 = extractor.getInitialPage().getNextPage();
|
||||||
assertEquals("https://bandcamp.com/search?q=e&page=2", page2.getUrl());
|
assertEquals("https://bandcamp.com/search?q=e&page=2", page2.getUrl());
|
||||||
|
|
||||||
Page page3 = extractor.getPage(page2).getNextPage();
|
final Page page3 = extractor.getPage(page2).getNextPage();
|
||||||
assertEquals("https://bandcamp.com/search?q=e&page=3", page3.getUrl());
|
assertEquals("https://bandcamp.com/search?q=e&page=3", page3.getUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class BandcampStreamExtractorTest extends DefaultStreamExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testArtistProfilePicture() throws Exception {
|
public void testArtistProfilePicture() throws Exception {
|
||||||
String url = extractor().getUploaderAvatarUrl();
|
final String url = extractor().getUploaderAvatarUrl();
|
||||||
assertTrue(url.contains("://f4.bcbits.com/img/") && url.endsWith(".jpg"));
|
assertTrue(url.contains("://f4.bcbits.com/img/") && url.endsWith(".jpg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class BandcampSuggestionExtractorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchExample() throws IOException, ExtractionException {
|
public void testSearchExample() throws IOException, ExtractionException {
|
||||||
List<String> c418 = extractor.suggestionList("c418");
|
final List<String> c418 = extractor.suggestionList("c418");
|
||||||
|
|
||||||
assertTrue(c418.contains("C418"));
|
assertTrue(c418.contains("C418"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue