@Test public void shouldNotSetNullState() { AuthenticationRequest authenticationRequest = new AuthenticationRequest.Builder(mClientId, mResponseType, mRedirectUri) .setState(null) .build(); Uri.Builder uriBuilder = getBaseAuthUri(mClientId, mResponseType.toString(), mRedirectUri, mDefaultCampaign); Uri uri = uriBuilder.build(); assertEquals(uri, authenticationRequest.toUri()); }
public Uri toUri() { Uri.Builder uriBuilder = new Uri.Builder(); uriBuilder.scheme(ACCOUNTS_SCHEME) .authority(ACCOUNTS_AUTHORITY) .appendPath(ACCOUNTS_PATH) .appendQueryParameter(QueryParams.CLIENT_ID, mClientId) .appendQueryParameter(QueryParams.RESPONSE_TYPE, mResponseType) .appendQueryParameter(QueryParams.REDIRECT_URI, mRedirectUri) .appendQueryParameter(QueryParams.SHOW_DIALOG, String.valueOf(mShowDialog)) .appendQueryParameter(QueryParams.UTM_SOURCE, SPOTIFY_SDK) .appendQueryParameter(QueryParams.UTM_MEDIUM, ANDROID_SDK) .appendQueryParameter(QueryParams.UTM_CAMPAIGN, getCampaign()); if (mScopes != null && mScopes.length > 0) { uriBuilder.appendQueryParameter(QueryParams.SCOPE, scopesToString()); } if (mState != null) { uriBuilder.appendQueryParameter(QueryParams.STATE, mState); } if (mCustomParams.size() > 0) { for (Map.Entry<String, String> entry : mCustomParams.entrySet()) { uriBuilder.appendQueryParameter(entry.getKey(), entry.getValue()); } } return uriBuilder.build(); }
AuthenticationRequest implements Parcelable { public Uri toUri() { Uri.Builder uriBuilder = new Uri.Builder(); uriBuilder.scheme(ACCOUNTS_SCHEME) .authority(ACCOUNTS_AUTHORITY) .appendPath(ACCOUNTS_PATH) .appendQueryParameter(QueryParams.CLIENT_ID, mClientId) .appendQueryParameter(QueryParams.RESPONSE_TYPE, mResponseType) .appendQueryParameter(QueryParams.REDIRECT_URI, mRedirectUri) .appendQueryParameter(QueryParams.SHOW_DIALOG, String.valueOf(mShowDialog)) .appendQueryParameter(QueryParams.UTM_SOURCE, SPOTIFY_SDK) .appendQueryParameter(QueryParams.UTM_MEDIUM, ANDROID_SDK) .appendQueryParameter(QueryParams.UTM_CAMPAIGN, getCampaign()); if (mScopes != null && mScopes.length > 0) { uriBuilder.appendQueryParameter(QueryParams.SCOPE, scopesToString()); } if (mState != null) { uriBuilder.appendQueryParameter(QueryParams.STATE, mState); } if (mCustomParams.size() > 0) { for (Map.Entry<String, String> entry : mCustomParams.entrySet()) { uriBuilder.appendQueryParameter(entry.getKey(), entry.getValue()); } } return uriBuilder.build(); } }
AuthenticationRequest implements Parcelable { public Uri toUri() { Uri.Builder uriBuilder = new Uri.Builder(); uriBuilder.scheme(ACCOUNTS_SCHEME) .authority(ACCOUNTS_AUTHORITY) .appendPath(ACCOUNTS_PATH) .appendQueryParameter(QueryParams.CLIENT_ID, mClientId) .appendQueryParameter(QueryParams.RESPONSE_TYPE, mResponseType) .appendQueryParameter(QueryParams.REDIRECT_URI, mRedirectUri) .appendQueryParameter(QueryParams.SHOW_DIALOG, String.valueOf(mShowDialog)) .appendQueryParameter(QueryParams.UTM_SOURCE, SPOTIFY_SDK) .appendQueryParameter(QueryParams.UTM_MEDIUM, ANDROID_SDK) .appendQueryParameter(QueryParams.UTM_CAMPAIGN, getCampaign()); if (mScopes != null && mScopes.length > 0) { uriBuilder.appendQueryParameter(QueryParams.SCOPE, scopesToString()); } if (mState != null) { uriBuilder.appendQueryParameter(QueryParams.STATE, mState); } if (mCustomParams.size() > 0) { for (Map.Entry<String, String> entry : mCustomParams.entrySet()) { uriBuilder.appendQueryParameter(entry.getKey(), entry.getValue()); } } return uriBuilder.build(); } AuthenticationRequest(Parcel source); private  AuthenticationRequest(String clientId,
                                  AuthenticationResponse.Type responseType,
                                  String redirectUri,
                                  String state,
                                  String[] scopes,
                                  boolean showDialog,
                                  Map<String, String> customParams,
                                  String campaign); }
AuthenticationRequest implements Parcelable { public Uri toUri() { Uri.Builder uriBuilder = new Uri.Builder(); uriBuilder.scheme(ACCOUNTS_SCHEME) .authority(ACCOUNTS_AUTHORITY) .appendPath(ACCOUNTS_PATH) .appendQueryParameter(QueryParams.CLIENT_ID, mClientId) .appendQueryParameter(QueryParams.RESPONSE_TYPE, mResponseType) .appendQueryParameter(QueryParams.REDIRECT_URI, mRedirectUri) .appendQueryParameter(QueryParams.SHOW_DIALOG, String.valueOf(mShowDialog)) .appendQueryParameter(QueryParams.UTM_SOURCE, SPOTIFY_SDK) .appendQueryParameter(QueryParams.UTM_MEDIUM, ANDROID_SDK) .appendQueryParameter(QueryParams.UTM_CAMPAIGN, getCampaign()); if (mScopes != null && mScopes.length > 0) { uriBuilder.appendQueryParameter(QueryParams.SCOPE, scopesToString()); } if (mState != null) { uriBuilder.appendQueryParameter(QueryParams.STATE, mState); } if (mCustomParams.size() > 0) { for (Map.Entry<String, String> entry : mCustomParams.entrySet()) { uriBuilder.appendQueryParameter(entry.getKey(), entry.getValue()); } } return uriBuilder.build(); } AuthenticationRequest(Parcel source); private  AuthenticationRequest(String clientId,
                                  AuthenticationResponse.Type responseType,
                                  String redirectUri,
                                  String state,
                                  String[] scopes,
                                  boolean showDialog,
                                  Map<String, String> customParams,
                                  String campaign); String getClientId(); String getResponseType(); String getRedirectUri(); String getState(); String[] getScopes(); String getCustomParam(String key); String getCampaign(); Uri toUri(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); }
AuthenticationRequest implements Parcelable { public Uri toUri() { Uri.Builder uriBuilder = new Uri.Builder(); uriBuilder.scheme(ACCOUNTS_SCHEME) .authority(ACCOUNTS_AUTHORITY) .appendPath(ACCOUNTS_PATH) .appendQueryParameter(QueryParams.CLIENT_ID, mClientId) .appendQueryParameter(QueryParams.RESPONSE_TYPE, mResponseType) .appendQueryParameter(QueryParams.REDIRECT_URI, mRedirectUri) .appendQueryParameter(QueryParams.SHOW_DIALOG, String.valueOf(mShowDialog)) .appendQueryParameter(QueryParams.UTM_SOURCE, SPOTIFY_SDK) .appendQueryParameter(QueryParams.UTM_MEDIUM, ANDROID_SDK) .appendQueryParameter(QueryParams.UTM_CAMPAIGN, getCampaign()); if (mScopes != null && mScopes.length > 0) { uriBuilder.appendQueryParameter(QueryParams.SCOPE, scopesToString()); } if (mState != null) { uriBuilder.appendQueryParameter(QueryParams.STATE, mState); } if (mCustomParams.size() > 0) { for (Map.Entry<String, String> entry : mCustomParams.entrySet()) { uriBuilder.appendQueryParameter(entry.getKey(), entry.getValue()); } } return uriBuilder.build(); } AuthenticationRequest(Parcel source); private  AuthenticationRequest(String clientId,
                                  AuthenticationResponse.Type responseType,
                                  String redirectUri,
                                  String state,
                                  String[] scopes,
                                  boolean showDialog,
                                  Map<String, String> customParams,
                                  String campaign); String getClientId(); String getResponseType(); String getRedirectUri(); String getState(); String[] getScopes(); String getCustomParam(String key); String getCampaign(); Uri toUri(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); static final Parcelable.Creator<AuthenticationRequest> CREATOR; }