Skip to content

Commit 5c24548

Browse files
committed
Add tests.
1 parent 92e1041 commit 5c24548

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public AuthorizationCodeFlow(
134134
GenericUrl tokenServerUrl,
135135
HttpExecuteInterceptor clientAuthentication,
136136
String clientId,
137-
String authorizationServerEncodedUrl,
138-
Map<String, String> additionalParameters) {
137+
String authorizationServerEncodedUrl)
138+
{
139139
this(
140140
new Builder(
141141
method,
@@ -145,7 +145,8 @@ public AuthorizationCodeFlow(
145145
clientAuthentication,
146146
clientId,
147147
authorizationServerEncodedUrl,
148-
additionalParameters));
148+
Collections.<String, String>emptyMap()
149+
));
149150
}
150151

151152
/**

google-oauth-client/src/test/java/com/google/api/client/auth/oauth2/AuthorizationCodeRequestUrlTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
package com.google.api.client.auth.oauth2;
1616

1717
import java.util.Arrays;
18+
import java.util.HashMap;
19+
import java.util.Map;
1820
import junit.framework.TestCase;
1921

2022
/**
@@ -41,4 +43,23 @@ public void testBuild() {
4143
.setScopes(Arrays.asList("a", "b", "c"));
4244
assertEquals(EXPECTED, url.build());
4345
}
46+
47+
public void testAdditionalParams() {
48+
49+
Map<String, String> testMap = new HashMap<>();
50+
String expectedUrl =
51+
"https://server.example.com/authorize?client_id=s6BhdRkqt3&"
52+
+ "redirect_uri=https://client.example.com/rd&response_type=code"
53+
+ "&scope=a%20b%20c&state=xyz&param1=value1";
54+
55+
testMap.put("param1", "value1");
56+
AuthorizationRequestUrl url =
57+
new AuthorizationCodeRequestUrl("https://server.example.com/authorize", "s6BhdRkqt3")
58+
.setState("xyz")
59+
.setRedirectUri("https://client.example.com/rd")
60+
.setScopes(Arrays.asList("a", "b", "c"));
61+
62+
assertEquals(expectedUrl, url.build());
63+
}
64+
4465
}

0 commit comments

Comments
 (0)