Skip to content

Commit

Permalink
URI Examples
Browse files Browse the repository at this point in the history
~ Fix URI usage in examples and other classes
  • Loading branch information
dargmuesli committed Mar 3, 2018
1 parent dedf213 commit e1fb437
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ The following (random) data should be used when modifying examples:
- Time range: `"medium_term"`
- Timestamp: `new Date(1414054800000L)`
- Tracks: `new JsonParser().parse("[\"01iyCAUm8EvOFqVWYJ3dVX\"]").getAsJsonArray()`
- URIs: `new JsonParser().parse("{\"01iyCAUm8EvOFqVWYJ3dVX\"}").getAsJsonArray()`
- URIs: `new JsonParser().parse("{\"spotify:track:01iyCAUm8EvOFqVWYJ3dVX\"}").getAsJsonArray()`
2 changes: 1 addition & 1 deletion examples/data/player/StartResumeUsersPlaybackExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class StartResumeUsersPlaybackExample {
.context_uri("spotify:album:5zT1JLIj9E57p3e1rFm9Uq")
.device_id("5fbb3ba6aa454b5534c4ba43a8c7e8e45a63ad0e")
.offset(new JsonParser().parse("{\"uri\":\"spotify:track:01iyCAUm8EvOFqVWYJ3dVX\"}").getAsJsonObject())
.uris(new JsonParser().parse("{\"01iyCAUm8EvOFqVWYJ3dVX\"}").getAsJsonArray())
.uris(new JsonParser().parse("[\"spotify:track:01iyCAUm8EvOFqVWYJ3dVX\"]").getAsJsonArray())
.build();

public static void startResumeUsersPlayback_Sync() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/wrapper/spotify/ITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public interface ITest<T> {
String Q = "Abba";
int RANGE_LENGTH = 1;
int RANGE_START = 0;
String[] SCOPES = new String[]{"user-read-birthday", "user-read-email"};
String SCOPE = "user-read-birthday user-read-email";
String SEED_ARTISTS = "0LcJLqbBmaGUft1e9Mm8HV";
String SEED_GENRES = "electro";
String SEED_TRACKS = "01iyCAUm8EvOFqVWYJ3dVX";
Expand All @@ -72,7 +72,7 @@ public interface ITest<T> {
String TIME_RANGE = "medium_term";
Date TIMESTAMP = new Date(1414054800000L);
ModelObjectType TYPE = ModelObjectType.ARTIST;
JsonArray URIS = new JsonParser().parse("[\"01iyCAUm8EvOFqVWYJ3dVX\",\"01iyCAUm8EvOFqVWYJ3dVX\"]").getAsJsonArray();
JsonArray URIS = new JsonParser().parse("[\"spotify:track:01iyCAUm8EvOFqVWYJ3dVX\",\"spotify:track:01iyCAUm8EvOFqVWYJ3dVX\"]").getAsJsonArray();
int VOLUME_PERCENT = 100;

void shouldComplyWithReference();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
public class AuthorizationCodeUriRequestTest extends AbstractAuthorizationTest<URI> {

private final AuthorizationCodeUriRequest defaultRequest = SPOTIFY_API.authorizationCodeUri()
.scope(SCOPE)
.show_dialog(SHOW_DIALOG)
.build();

public AuthorizationCodeUriRequestTest() {
Expand All @@ -19,7 +21,7 @@ public AuthorizationCodeUriRequestTest() {
@Test
public void shouldComplyWithReference() {
assertEquals(
"https://accounts.spotify.com:443/authorize?client_id=zyuxhfo1c51b5hxjk09x2uhv5n0svgd6g&response_type=code&redirect_uri=https%3A%2F%2Fexample.com%2Fspotify-redirect",
"https://accounts.spotify.com:443/authorize?client_id=zyuxhfo1c51b5hxjk09x2uhv5n0svgd6g&response_type=code&redirect_uri=https%3A%2F%2Fexample.com%2Fspotify-redirect&scope=user-read-birthday+user-read-email&show_dialog=true",
defaultRequest.getUri().toString());
}

Expand All @@ -35,7 +37,7 @@ public void shouldReturnDefault_async() throws ExecutionException, InterruptedEx

public void shouldReturnDefault(final URI uri) {
assertEquals(
"https://accounts.spotify.com:443/authorize?client_id=zyuxhfo1c51b5hxjk09x2uhv5n0svgd6g&response_type=code&redirect_uri=https%3A%2F%2Fexample.com%2Fspotify-redirect",
"https://accounts.spotify.com:443/authorize?client_id=zyuxhfo1c51b5hxjk09x2uhv5n0svgd6g&response_type=code&redirect_uri=https%3A%2F%2Fexample.com%2Fspotify-redirect&scope=user-read-birthday+user-read-email&show_dialog=true",
uri.toString());
}
}

0 comments on commit e1fb437

Please sign in to comment.