### Question:
AuthorizationRequest { Uri getAuthorizationUri(URL baseOAuthUrl, String clientId) { try { final Uri.Builder builder = Uri.parse(new URL(baseOAuthUrl, ApiConstants.AUTHORIZE).toURI().toString()) .buildUpon() .appendQueryParameter(ARG_RESPONSE_TYPE, "code") .appendQueryParameter(ARG_CLIENT_ID, clientId) .appendQueryParameter(ARG_REDIRECT_URI, redirectUri.toString()) .appendQueryParameter(ARG_SCOPE, scope); if (showSignUp) { builder.appendQueryParameter(ARG_LAYOUT, LAYOUT_SIGNUP); } appendIfNotNull(builder, ARG_ACCOUNT, account); appendIfNotNull(builder, ARG_ACCOUNT_CURRENCY, accountCurrency); appendIfNotNull(builder, ARG_REFERRAL, referralId); appendIfNotNull(builder, META_NAME, metaName); appendIfNotNull(builder, META_SEND_LIMIT_AMOUNT, sendLimitAmount); appendIfNotNull(builder, META_SEND_LIMIT_CURRENCY, sendLimitCurrency); appendIfNotNull(builder, META_SEND_LIMIT_PERIOD, sendLimitPeriod); return builder.build(); } catch (URISyntaxException | MalformedURLException e) { throw new IllegalArgumentException(e); } } AuthorizationRequest(@NonNull Uri redirectUri,
                                @NonNull String... scopes); AuthorizationRequest setAccount(AccountSetting account); AuthorizationRequest setShowSignUpPage(boolean showSignUp); AuthorizationRequest setAccountCurrency(String currency); AuthorizationRequest setReferralId(String referralId); AuthorizationRequest setMetaName(String name); AuthorizationRequest setMetaSendLimitAmount(String limitAmount); AuthorizationRequest setMetaSendLimitCurrency(String limitCurrency); AuthorizationRequest setMetaSendLimitPeriod(LimitPeriod limitPeriod);  }### Answer:
@Test public void shouldBuildCorrectUri() throws Exception { final String clientId = "clientId"; final Uri redirectUri = Uri.parse("coinbase: final String scope = "user:read"; final String baseOauthUrl = "https: final URL url = new URL(baseOauthUrl); final Uri wantedUri = Uri.parse(baseOauthUrl) .buildUpon() .path(ApiConstants.AUTHORIZE) .appendQueryParameter(AuthorizationRequest.ARG_RESPONSE_TYPE, "code") .appendQueryParameter(AuthorizationRequest.ARG_CLIENT_ID, clientId) .appendQueryParameter(AuthorizationRequest.ARG_REDIRECT_URI, redirectUri.toString()) .appendQueryParameter(AuthorizationRequest.ARG_SCOPE, scope) .build(); final Uri authorizationUri = new AuthorizationRequest(redirectUri, scope) .getAuthorizationUri(url, clientId); assertThat(authorizationUri).isEqualTo(wantedUri); }