Skip to content

Commit 902b6ce

Browse files
committed
chore: Fix constant usage in tests
1 parent 3908a3e commit 902b6ce

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

oauth2_http/javatests/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public class MockExternalAccountCredentialsTransport extends MockHttpTransport {
6262

6363
private static final String EXPECTED_GRANT_TYPE =
6464
"urn:ietf:params:oauth:grant-type:token-exchange";
65-
private static final String CLOUD_PLATFORM_SCOPE = OAuth2Utils.CLOUD_PLATFORM_SCOPE;
6665
private static final String ISSUED_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:access_token";
6766
private static final String AWS_CREDENTIALS_URL = "https://169.254.169.254";
6867
private static final String AWS_REGION_URL = "https://169.254.169.254/region";
@@ -201,7 +200,7 @@ public LowLevelHttpResponse execute() throws IOException {
201200
OAuth2Utils.JSON_FACTORY
202201
.createJsonParser(getContentAsString())
203202
.parseAndClose(GenericJson.class);
204-
assertEquals(CLOUD_PLATFORM_SCOPE, ((ArrayList<String>) query.get("scope")).get(0));
203+
assertEquals(OAuth2Utils.CLOUD_PLATFORM_SCOPE, ((ArrayList<String>) query.get("scope")).get(0));
205204
assertEquals(1, getHeaders().get("authorization").size());
206205
assertTrue(getHeaders().containsKey("authorization"));
207206
assertNotNull(getHeaders().get("authorization").get(0));

oauth2_http/javatests/com/google/auth/oauth2/StsRequestHandlerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import com.google.common.base.Joiner;
4343
import java.io.IOException;
4444
import java.util.Arrays;
45+
import java.util.Collections;
4546
import java.util.List;
4647
import java.util.Map;
4748
import org.junit.Before;
@@ -56,7 +57,6 @@ public final class StsRequestHandlerTest {
5657

5758
private static final String TOKEN_EXCHANGE_GRANT_TYPE =
5859
"urn:ietf:params:oauth:grant-type:token-exchange";
59-
private static final String CLOUD_PLATFORM_SCOPE = OAuth2Utils.CLOUD_PLATFORM_SCOPE;
6060
private static final String DEFAULT_REQUESTED_TOKEN_TYPE =
6161
"urn:ietf:params:oauth:token-type:access_token";
6262
private static final String TOKEN_URL = "https://sts.googleapis.com/v1/token";
@@ -72,7 +72,7 @@ public void setup() {
7272
public void exchangeToken() throws IOException {
7373
StsTokenExchangeRequest stsTokenExchangeRequest =
7474
StsTokenExchangeRequest.newBuilder("credential", "subjectTokenType")
75-
.setScopes(Arrays.asList(CLOUD_PLATFORM_SCOPE))
75+
.setScopes(Collections.singletonList(OAuth2Utils.CLOUD_PLATFORM_SCOPE))
7676
.build();
7777

7878
StsRequestHandler requestHandler =
@@ -92,7 +92,7 @@ public void exchangeToken() throws IOException {
9292
GenericData expectedRequestContent =
9393
new GenericData()
9494
.set("grant_type", TOKEN_EXCHANGE_GRANT_TYPE)
95-
.set("scope", CLOUD_PLATFORM_SCOPE)
95+
.set("scope", OAuth2Utils.CLOUD_PLATFORM_SCOPE)
9696
.set("requested_token_type", DEFAULT_REQUESTED_TOKEN_TYPE)
9797
.set("subject_token_type", stsTokenExchangeRequest.getSubjectTokenType())
9898
.set("subject_token", stsTokenExchangeRequest.getSubjectToken());
@@ -256,7 +256,7 @@ public void exchangeToken_noExpiresInReturned() throws IOException {
256256

257257
StsTokenExchangeRequest stsTokenExchangeRequest =
258258
StsTokenExchangeRequest.newBuilder("credential", "subjectTokenType")
259-
.setScopes(Arrays.asList(CLOUD_PLATFORM_SCOPE))
259+
.setScopes(Collections.singletonList(OAuth2Utils.CLOUD_PLATFORM_SCOPE))
260260
.build();
261261

262262
StsRequestHandler requestHandler =

0 commit comments

Comments
 (0)