1919import java .io .IOException ;
2020import java .util .List ;
2121
22- import static org .junit .jupiter .api .Assertions .*;
22+ import static org .junit .jupiter .api .Assertions .assertEquals ;
23+ import static org .junit .jupiter .api .Assertions .assertFalse ;
24+ import static org .junit .jupiter .api .Assertions .assertNotEquals ;
25+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
26+ import static org .junit .jupiter .api .Assertions .assertNull ;
27+ import static org .junit .jupiter .api .Assertions .assertThrows ;
28+ import static org .junit .jupiter .api .Assertions .assertTrue ;
2329import static org .schabi .newpipe .extractor .ExtractorAsserts .assertContains ;
30+ import static org .schabi .newpipe .extractor .ExtractorAsserts .assertContainsOnlyEquivalentImages ;
31+ import static org .schabi .newpipe .extractor .ExtractorAsserts .assertEmpty ;
32+ import static org .schabi .newpipe .extractor .ExtractorAsserts .assertNotOnlyContainsEquivalentImages ;
2433import static org .schabi .newpipe .extractor .ServiceList .Bandcamp ;
2534
2635/**
@@ -37,7 +46,7 @@ public static void setUp() {
3746 * Test whether playlists contain the correct amount of items
3847 */
3948 @ Test
40- public void testCount () throws ExtractionException , IOException {
49+ void testCount () throws ExtractionException , IOException {
4150 final PlaylistExtractor extractor = Bandcamp .getPlaylistExtractor ("https://macbenson.bandcamp.com/album/coming-of-age" );
4251 extractor .fetchPage ();
4352
@@ -48,37 +57,37 @@ public void testCount() throws ExtractionException, IOException {
4857 * Tests whether different stream thumbnails (track covers) get loaded correctly
4958 */
5059 @ Test
51- public void testDifferentTrackCovers () throws ExtractionException , IOException {
60+ void testDifferentTrackCovers () throws ExtractionException , IOException {
5261 final PlaylistExtractor extractor = Bandcamp .getPlaylistExtractor ("https://zachbensonarchive.bandcamp.com/album/results-of-boredom" );
5362 extractor .fetchPage ();
5463
5564 final List <StreamInfoItem > l = extractor .getInitialPage ().getItems ();
56- assertEquals (extractor .getThumbnailUrl (), l .get (0 ).getThumbnailUrl ());
57- assertNotEquals (extractor .getThumbnailUrl (), l .get (5 ).getThumbnailUrl ());
65+ assertContainsOnlyEquivalentImages (extractor .getThumbnails (), l .get (0 ).getThumbnails ());
66+ assertNotOnlyContainsEquivalentImages (extractor .getThumbnails (), l .get (5 ).getThumbnails ());
5867 }
5968
6069 /**
6170 * Tests that no attempt to load every track's cover individually is made
6271 */
6372 @ Test
6473 @ Timeout (10 )
65- public void testDifferentTrackCoversDuration () throws ExtractionException , IOException {
74+ void testDifferentTrackCoversDuration () throws ExtractionException , IOException {
6675 final PlaylistExtractor extractor = Bandcamp .getPlaylistExtractor ("https://infiniteammo.bandcamp.com/album/night-in-the-woods-vol-1-at-the-end-of-everything" );
6776 extractor .fetchPage ();
6877
69- /* All tracks in this album have the same cover art, but I don't know any albums with more than 10 tracks
70- * that has at least one track with a cover art different from the rest.
78+ /* All tracks on this album have the same cover art, but I don't know any albums with more
79+ * than 10 tracks that has at least one track with a cover art different from the rest.
7180 */
7281 final List <StreamInfoItem > l = extractor .getInitialPage ().getItems ();
73- assertEquals (extractor .getThumbnailUrl (), l .get (0 ).getThumbnailUrl ());
74- assertEquals (extractor .getThumbnailUrl (), l .get (5 ).getThumbnailUrl ());
82+ assertContainsOnlyEquivalentImages (extractor .getThumbnails (), l .get (0 ).getThumbnails ());
83+ assertContainsOnlyEquivalentImages (extractor .getThumbnails (), l .get (5 ).getThumbnails ());
7584 }
7685
7786 /**
7887 * Test playlists with locked content
7988 */
8089 @ Test
81- public void testLockedContent () throws ExtractionException , IOException {
90+ void testLockedContent () throws ExtractionException {
8291 final PlaylistExtractor extractor = Bandcamp .getPlaylistExtractor ("https://billwurtz.bandcamp.com/album/high-enough" );
8392
8493 assertThrows (ContentNotAvailableException .class , extractor ::fetchPage );
@@ -88,12 +97,11 @@ public void testLockedContent() throws ExtractionException, IOException {
8897 * Test playlist with just one track
8998 */
9099 @ Test
91- public void testSingleStreamPlaylist () throws ExtractionException , IOException {
100+ void testSingleStreamPlaylist () throws ExtractionException , IOException {
92101 final PlaylistExtractor extractor = Bandcamp .getPlaylistExtractor ("https://zachjohnson1.bandcamp.com/album/endless" );
93102 extractor .fetchPage ();
94103
95104 assertEquals (1 , extractor .getStreamCount ());
96-
97105 }
98106
99107 public static class ComingOfAge implements BasePlaylistExtractorTest {
@@ -108,17 +116,17 @@ public static void setUp() throws ExtractionException, IOException {
108116 }
109117
110118 @ Test
111- public void testThumbnailUrl () throws ParsingException {
112- assertTrue (extractor .getThumbnailUrl (). contains ( "f4.bcbits.com/img" ));
119+ public void testThumbnails () throws ParsingException {
120+ BandcampTestUtils . testImages (extractor .getThumbnails ( ));
113121 }
114122
115123 @ Test
116- public void testBannerUrl () throws ParsingException {
117- assertEquals ( "" , extractor .getBannerUrl ());
124+ public void testBanners () throws ParsingException {
125+ assertEmpty ( extractor .getBanners ());
118126 }
119127
120128 @ Test
121- public void testUploaderUrl () throws ParsingException {
129+ void testUploaderUrl () throws ParsingException {
122130 assertTrue (extractor .getUploaderUrl ().contains ("macbenson.bandcamp.com" ));
123131 }
124132
@@ -128,8 +136,8 @@ public void testUploaderName() throws ParsingException {
128136 }
129137
130138 @ Test
131- public void testUploaderAvatarUrl () throws ParsingException {
132- assertTrue (extractor .getUploaderAvatarUrl (). contains ( "f4.bcbits.com/img" ));
139+ public void testUploaderAvatars () throws ParsingException {
140+ BandcampTestUtils . testImages (extractor .getUploaderAvatars ( ));
133141 }
134142
135143 @ Test
@@ -147,13 +155,14 @@ public void testDescription() throws ParsingException {
147155 assertContains ("all rights reserved" , description .getContent ()); // license
148156 }
149157
158+ @ Test
150159 @ Override
151160 public void testUploaderVerified () throws Exception {
152161 assertFalse (extractor .isUploaderVerified ());
153162 }
154163
155164 @ Test
156- public void testInitialPage () throws IOException , ExtractionException {
165+ void testInitialPage () throws IOException , ExtractionException {
157166 assertNotNull (extractor .getInitialPage ().getItems ().get (0 ));
158167 }
159168
@@ -183,7 +192,7 @@ public void testOriginalUrl() throws Exception {
183192 }
184193
185194 @ Test
186- public void testNextPageUrl () throws IOException , ExtractionException {
195+ void testNextPageUrl () throws IOException , ExtractionException {
187196 assertNull (extractor .getPage (extractor .getInitialPage ().getNextPage ()));
188197 }
189198
0 commit comments