-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSpotifyRestAPITest.java
64 lines (47 loc) · 1.43 KB
/
SpotifyRestAPITest.java
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
59
60
61
62
63
64
package Client;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.*;
class SpotifyRestAPITest {
static SpotifyClient client;
static {
try {
client = new SpotifyClient("d56c8c3f79a1459bba2c286cfa7aa15b","9dcd475a773d467990dd75eede0af55f");
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
void makeRequest() {
}
@Test
void implicitGrant() throws IOException {
client.implicitGrantTokenRequest();
assertTrue(client.getToken().length() > 0);
}
/*
REMOVE LOGIN AFTER TESTS
*/
@Test
void requestAuthorizationCodeFlow() throws IOException {
try {
client.getLogin().setEmailOrUsername("exampleUsername@email.com");
client.getLogin().setPassword("examplePassword");
client.getLogin().setRedirectUri("exampleRedirect");
client.requestAuthCodeFlowCode(client);
assertNotEquals("",client.getLogin().getAuthCode());
}
catch(Exception ignored){
System.out.println("Exception thrown");
}
}
@Test
void requestAuthorizationAccessTokenAndRefresh(){
try{
assertNotNull(client.generateAccessTokenAndRefreshToken(client));
}
catch(Exception ignored){
System.out.println("Exception thrown");
}
}
}