Repository navigation
Expand file tree
/
Copy pathPersonalizationTest.java
More file actions
58 lines (41 loc) · 1.62 KB
/
Copy pathPersonalizationTest.java
File metadata and controls
58 lines (41 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package getRequests;
import Client.SpotifyClient;
import Client.SpotifyLogin;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public class PersonalizationTest {
static SpotifyClient client;
static {
try {
client = new SpotifyClient("d56c8c3f79a1459bba2c286cfa7aa15b", "9dcd475a773d467990dd75eede0af55f");
SpotifyLogin login = client.getLogin();
login.setEmailOrUsername("exampleEmail");
login.setPassword("examplePasword");
login.setRedirectUri("exampleRedirectURI");
login.addScope("user-top-read");
client.requestAuthCodeFlowCode(client);
client.generateAccessTokenAndRefreshToken(client);
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
@Test
void getUserTopArtist() throws IOException {
Personalization personalization = client.getPersonalization();
personalization.setType("artists");
personalization.setTime_range("medium_term");
personalization.setLimit(5);
personalization.setOffset(10);
assertNotNull(client.getUserTopTracksAndArtists(client));
}
@Test
void getUserTopTracks() throws IOException {
Personalization personalization = client.getPersonalization();
personalization.setType("tracks");
personalization.setTime_range("medium_term");
personalization.setLimit(5);
personalization.setOffset(10);
assertNotNull(client.getUserTopTracksAndArtists(client));
}
}