Fix imports

This commit is contained in:
Mario Petrovski 2023-09-13 15:33:21 +02:00 committed by Josh Cummings
parent 97ec5c921e
commit 2ee8f27997
1 changed files with 8 additions and 5 deletions

View File

@ -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}
@ -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