mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 09:12:14 +00:00
Fix imports in tests
This commit is contained in:
parent
e1db108cb9
commit
97ec5c921e
@ -19,8 +19,8 @@ package org.springframework.security.oauth2.core;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.security.authorization.AuthorityAuthorizationManager;
|
import org.springframework.security.authorization.AuthorityAuthorizationManager;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link OAuth2AuthorizationManagers}
|
* Tests for {@link OAuth2AuthorizationManagers}
|
||||||
@ -32,27 +32,29 @@ public class OAuth2AuthorizationManagersTests {
|
|||||||
@Test
|
@Test
|
||||||
void hasScope_withInvalidScope_shouldThrowIllegalArgumentException() {
|
void hasScope_withInvalidScope_shouldThrowIllegalArgumentException() {
|
||||||
String scope = "SCOPE_invalid";
|
String scope = "SCOPE_invalid";
|
||||||
assertThrows(IllegalArgumentException.class, () -> OAuth2AuthorizationManagers.hasScope(scope));
|
assertThatThrownBy(() -> OAuth2AuthorizationManagers.hasScope(scope))
|
||||||
|
.isInstanceOf(IllegalArgumentException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasScopes_withInvalidScope_shouldThrowIllegalArgumentException() {
|
void hasScopes_withInvalidScope_shouldThrowIllegalArgumentException() {
|
||||||
String[] scopes = { "read", "write", "SCOPE_invalid" };
|
String[] scopes = { "read", "write", "SCOPE_invalid" };
|
||||||
assertThrows(IllegalArgumentException.class, () -> OAuth2AuthorizationManagers.hasAnyScope(scopes));
|
assertThatThrownBy(() -> OAuth2AuthorizationManagers.hasAnyScope(scopes))
|
||||||
|
.isInstanceOf(IllegalArgumentException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasScope_withValidScope_shouldPass() {
|
void hasScope_withValidScope_shouldPass() {
|
||||||
String scope = "read";
|
String scope = "read";
|
||||||
AuthorityAuthorizationManager<Object> authorizationManager = OAuth2AuthorizationManagers.hasScope(scope);
|
AuthorityAuthorizationManager<Object> authorizationManager = OAuth2AuthorizationManagers.hasScope(scope);
|
||||||
assertNotNull(authorizationManager);
|
assertThat(authorizationManager).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasScope_withValidScopes_shouldPass() {
|
void hasScope_withValidScopes_shouldPass() {
|
||||||
String[] scopes = { "read", "write" };
|
String[] scopes = { "read", "write" };
|
||||||
AuthorityAuthorizationManager<Object> authorizationManager = OAuth2AuthorizationManagers.hasAnyScope(scopes);
|
AuthorityAuthorizationManager<Object> authorizationManager = OAuth2AuthorizationManagers.hasAnyScope(scopes);
|
||||||
assertNotNull(authorizationManager);
|
assertThat(authorizationManager).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user