Skip to content

Commit

Permalink
Fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
petrovskimario authored and jzheaux committed Oct 2, 2023
1 parent 97ec5c9 commit 2ee8f27
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
package org.springframework.security.oauth2.core;

import org.junit.jupiter.api.Test;

import org.springframework.security.authorization.AuthorityAuthorizationManager;

import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

/**
* Tests for {@link OAuth2AuthorizationManagers}
Expand All @@ -32,15 +33,17 @@ public class OAuth2AuthorizationManagersTests {
@Test
void hasScope_withInvalidScope_shouldThrowIllegalArgumentException() {
String scope = "SCOPE_invalid";
assertThatThrownBy(() -> OAuth2AuthorizationManagers.hasScope(scope))
.isInstanceOf(IllegalArgumentException.class);
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> OAuth2AuthorizationManagers.hasScope(scope))
.withMessage("Scope 'SCOPE_invalid' start with 'SCOPE_' prefix.");
}

@Test
void hasScopes_withInvalidScope_shouldThrowIllegalArgumentException() {
String[] scopes = { "read", "write", "SCOPE_invalid" };
assertThatThrownBy(() -> OAuth2AuthorizationManagers.hasAnyScope(scopes))
.isInstanceOf(IllegalArgumentException.class);
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> OAuth2AuthorizationManagers.hasAnyScope(scopes))
.withMessage("Scope 'SCOPE_invalid' start with 'SCOPE_' prefix.");
}

@Test
Expand Down

0 comments on commit 2ee8f27

Please sign in to comment.