Skip to content

Commit 86d16f0

Browse files
Update testcase
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
1 parent 5ce2b6a commit 86d16f0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/src/test/java/org/springframework/security/authorization/AuthorityAuthorizationManagerTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.junit.jupiter.api.Test;
2323

24+
import org.springframework.security.access.AccessDeniedException;
2425
import org.springframework.security.access.hierarchicalroles.NullRoleHierarchy;
2526
import org.springframework.security.access.hierarchicalroles.RoleHierarchy;
2627
import org.springframework.security.access.hierarchicalroles.RoleHierarchyImpl;
@@ -273,21 +274,21 @@ void hasAnyRoleWhenEmptyRolePrefixThenNoException() {
273274
}
274275

275276
@Test
276-
void hasScopes_withInvalidScope_shouldThrowIllegalArgumentException() {
277+
void hasAnyScopeWhenInvalidScopeThenThrowIllegalArgument() {
277278
String[] scopes = { "read", "write", "SCOPE_invalid" };
278279
assertThatExceptionOfType(IllegalArgumentException.class)
279280
.isThrownBy(() -> AuthorityAuthorizationManager.hasAnyScope(scopes))
280-
.withMessage("Scope 'SCOPE_invalid' start with 'SCOPE_' prefix.");
281+
.withMessageContaining("SCOPE_invalid should not start with SCOPE_");
281282
}
282283

283284
@Test
284-
void hasScope_withValidScope_shouldPass() {
285+
void hasScopeWhenValidScope() {
285286
String scope = "read";
286287
assertThat(AuthorityAuthorizationManager.hasScope(scope)).isNotNull();
287288
}
288289

289290
@Test
290-
void hasScope_withValidScopes_shouldPass() {
291+
void hasAnyScopeWhenValidScopes() {
291292
String[] scopes = { "read", "write" };
292293
assertThat(AuthorityAuthorizationManager.hasAnyScope(scopes)).isNotNull();
293294
}

0 commit comments

Comments
 (0)