Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public Builder setExpirationInSeconds(int durationInSeconds) {
}

public Builder addScope(String scope) {
Preconditions.checkArgument(OAuth2Util.isValidScopeToken(scope), "Invalid scope: %s");
Preconditions.checkArgument(OAuth2Util.isValidScopeToken(scope), "Invalid scope: %s", scope);
this.scopes.add(scope);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,11 @@ public void testFailures() {
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Cannot parse to a string value: token_type: 34");
}

@Test
void invalidScopeReportsScopeValue() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void invalidScopeReportsScopeValue() {
void addInvalidScope() {

assertThatThrownBy(() -> OAuthTokenResponse.builder().addScope("bad scope"))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Invalid scope: bad scope");
}
}
Loading