Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 373417f

Browse files
authored
Merge pull request #25 from FelixGail/develop
Release 0.3.1
2 parents 6152ab2 + d64e72f commit 373417f

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.felixgail</groupId>
88
<artifactId>gplaymusic</artifactId>
9-
<version>0.3.0</version>
9+
<version>0.3.1</version>
1010
<packaging>jar</packaging>
1111
<name>${project.groupId}:${project.artifactId}</name>
1212
<url>https://github.com/felixgail/gplaymusic</url>

src/main/java/com/github/felixgail/gplaymusic/api/GPlayService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Call<Void> getTrackLocationSongId(@Header("X-Device-ID") String androidID,
169169
@GET("sj/v2.5/fetchartist")
170170
Call<Artist> getArtist(@Query("nid") String artistID, @Query("include-albums") boolean includeAlbums,
171171
@Query("num-top-tracks") int numTopTracks,
172-
@Query("num-related-artist") int numRelArtist);
172+
@Query("num-related-artists") int numRelArtist);
173173

174174
default MutationResponse makeBatchCall(String path, Mutator body)
175175
throws IOException {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.github.felixgail.gplaymusic;
2+
3+
import com.github.felixgail.gplaymusic.model.Artist;
4+
import com.github.felixgail.gplaymusic.model.enums.ResultType;
5+
import com.github.felixgail.gplaymusic.model.requests.SearchTypes;
6+
import com.github.felixgail.gplaymusic.util.TestUtil;
7+
import org.junit.Assert;
8+
import org.junit.BeforeClass;
9+
import org.junit.Test;
10+
import svarzee.gps.gpsoauth.Gpsoauth;
11+
12+
import java.io.IOException;
13+
import java.util.List;
14+
15+
import static com.github.felixgail.gplaymusic.TestWithLogin.getApi;
16+
import static com.github.felixgail.gplaymusic.TestWithLogin.loginToService;
17+
18+
public class ArtistTest {
19+
20+
@BeforeClass
21+
public static void before() throws IOException, Gpsoauth.TokenRequestFailed {
22+
loginToService(TestUtil.USERNAME, TestUtil.PASSWORD, TestUtil.ANDROID_ID, TestUtil.TOKEN);
23+
}
24+
25+
@Test
26+
public void testRelatedArtists() throws IOException {
27+
List<Artist> artistList = getApi().search("John", new SearchTypes(ResultType.ARTIST)).getArtists();
28+
Assert.assertNotNull(artistList);
29+
Assert.assertNotEquals(0, artistList.size());
30+
int relArtistNum = 0;
31+
for(Artist artist : artistList) {
32+
if(artist.getArtistId().isPresent()) {
33+
artist = getApi().getArtist(artist.getArtistId().get(), false, 0, 10);
34+
Assert.assertNotNull(artist);
35+
if(artist.getRelatedArtists().isPresent()){
36+
relArtistNum += 1;
37+
Assert.assertNotEquals(0, artist.getRelatedArtists().get().size());
38+
}
39+
}
40+
}
41+
Assert.assertNotEquals(
42+
String.format("No Artist (of %d) had a list of related artists", artistList.size()), 0,
43+
relArtistNum);
44+
System.out.printf("%d of %d artists had a list of related artists\n", relArtistNum, artistList.size());
45+
}
46+
47+
48+
}

0 commit comments

Comments
 (0)