### Question:
LinkedInApi20 extends DefaultApi20 { @Override public String getAuthorizationUrl(OAuthConfig config) { Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback. LinkedIn does not support Out Of Band Auth."); if (config.hasScope()) { return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(state), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope())); } else { return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(state), OAuthEncoder.encode(config.getCallback())); } } LinkedInApi20();  LinkedInApi20(String state); @Override OAuthService createService(OAuthConfig config); @Override String getAccessTokenEndpoint(); @Override AccessTokenExtractor getAccessTokenExtractor(); Verb getAccessTokenVerb(); @Override String getAuthorizationUrl(OAuthConfig config); String getState();  }### Answer:
@Test public void testAuthorizationWithNoScopes() { String state = RandomStringUtils.randomAlphabetic(10); String key = RandomStringUtils.randomAlphabetic(10); String secret = RandomStringUtils.randomAlphabetic(10); LinkedInApi20 api = new LinkedInApi20(state); OAuthService service = new ServiceBuilder().provider(api).apiKey(key).apiSecret(secret) .callback("http: String expected = "https: + "&state=" + state + "&redirect_uri=" + OAuthEncoder.encode("http: assertEquals(expected, service.getAuthorizationUrl(null)); }
@Test public void testAuthorizationWithScopes() { String state = RandomStringUtils.randomAlphabetic(10); String key = RandomStringUtils.randomAlphabetic(10); String secret = RandomStringUtils.randomAlphabetic(10); LinkedInApi20 api = new LinkedInApi20(state); OAuthService service = new ServiceBuilder().provider(api).apiKey(key).apiSecret(secret) .callback("http: .build(); String expected = "https: + "&state=" + state + "&redirect_uri=" + OAuthEncoder.encode("http: + "&scope=" + "r_basicprofile%2Cr_emailaddress"; assertEquals(expected, service.getAuthorizationUrl(null)); }