fix compile warning in spring-security-test
Signed-off-by: Minu Kim <kmw106933@naver.com>
This commit is contained in:
+1
@@ -31,6 +31,7 @@ class OneTimeTokenAuthenticationTokenTests {
|
||||
|
||||
// gh-18095
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void shouldBeAbleToDeserializeFromJsonWithDefaultTypingActivated() throws IOException {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.registerModules(SecurityJackson2Modules.getModules(getClass().getClassLoader()));
|
||||
|
||||
+5
@@ -59,6 +59,7 @@ public class OneTimeTokenReactiveAuthenticationManagerTests {
|
||||
private static final String TOKEN = "token";
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
public void constructorWhenOneTimeTokenServiceNullThenIllegalArgumentException() {
|
||||
ReactiveUserDetailsService userDetailsService = mock(ReactiveUserDetailsService.class);
|
||||
// @formatter:off
|
||||
@@ -68,6 +69,7 @@ public class OneTimeTokenReactiveAuthenticationManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
public void constructorWhenUserDetailsServiceNullThenIllegalArgumentException() {
|
||||
ReactiveOneTimeTokenService oneTimeTokenService = mock(ReactiveOneTimeTokenService.class);
|
||||
// @formatter:off
|
||||
@@ -77,6 +79,7 @@ public class OneTimeTokenReactiveAuthenticationManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void authenticateWhenOneTimeTokenAuthenticationTokenIsPresentThenSuccess() {
|
||||
ReactiveOneTimeTokenService oneTimeTokenService = mock(ReactiveOneTimeTokenService.class);
|
||||
given(oneTimeTokenService.consume(ArgumentMatchers.any(OneTimeTokenAuthenticationToken.class)))
|
||||
@@ -103,6 +106,7 @@ public class OneTimeTokenReactiveAuthenticationManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void authenticateWhenInvalidOneTimeTokenAuthenticationTokenIsPresentThenFail() {
|
||||
ReactiveOneTimeTokenService oneTimeTokenService = mock(ReactiveOneTimeTokenService.class);
|
||||
given(oneTimeTokenService.consume(ArgumentMatchers.any(OneTimeTokenAuthenticationToken.class)))
|
||||
@@ -120,6 +124,7 @@ public class OneTimeTokenReactiveAuthenticationManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void authenticateWhenIncorrectTypeOfAuthenticationIsPresentThenFail() {
|
||||
ReactiveOneTimeTokenService oneTimeTokenService = mock(ReactiveOneTimeTokenService.class);
|
||||
given(oneTimeTokenService.consume(ArgumentMatchers.any(OneTimeTokenAuthenticationToken.class)))
|
||||
|
||||
+3
-2
@@ -61,7 +61,7 @@ public class AuthorityAuthorizationManagerTests {
|
||||
|
||||
@Test
|
||||
public void hasAnyRoleWhenNullThenException() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> AuthorityAuthorizationManager.hasAnyRole(null))
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> AuthorityAuthorizationManager.hasAnyRole((String[]) null))
|
||||
.withMessage("roles cannot be empty");
|
||||
}
|
||||
|
||||
@@ -97,7 +97,8 @@ public class AuthorityAuthorizationManagerTests {
|
||||
|
||||
@Test
|
||||
public void hasAnyAuthorityWhenNullThenException() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> AuthorityAuthorizationManager.hasAnyAuthority(null))
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> AuthorityAuthorizationManager.hasAnyAuthority((String[]) null))
|
||||
.withMessage("authorities cannot be empty");
|
||||
}
|
||||
|
||||
|
||||
+14
-6
@@ -73,7 +73,8 @@ class DefaultMethodSecurityExpressionHandlerKotlinTests {
|
||||
)
|
||||
|
||||
assertThat(filtered).isInstanceOf(Map::class.java)
|
||||
val result = (filtered as Map<String, String>)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = filtered as Map<String, String>
|
||||
assertThat(result).hasSize(1)
|
||||
assertThat(result).containsKey("key2")
|
||||
assertThat(result).containsValue("value2")
|
||||
@@ -95,7 +96,8 @@ class DefaultMethodSecurityExpressionHandlerKotlinTests {
|
||||
)
|
||||
|
||||
assertThat(filtered).isInstanceOf(Map::class.java)
|
||||
val result = (filtered as Map<String, String>)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = filtered as Map<String, String>
|
||||
assertThat(result).hasSize(0)
|
||||
}
|
||||
|
||||
@@ -119,7 +121,8 @@ class DefaultMethodSecurityExpressionHandlerKotlinTests {
|
||||
)
|
||||
|
||||
assertThat(filtered).isInstanceOf(Collection::class.java)
|
||||
val result = (filtered as Collection<String>)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = filtered as Collection<String>
|
||||
assertThat(result).hasSize(1)
|
||||
assertThat(result).contains("string2")
|
||||
}
|
||||
@@ -140,7 +143,8 @@ class DefaultMethodSecurityExpressionHandlerKotlinTests {
|
||||
)
|
||||
|
||||
assertThat(filtered).isInstanceOf(Collection::class.java)
|
||||
val result = (filtered as Collection<String>)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = filtered as Collection<String>
|
||||
assertThat(result).hasSize(0)
|
||||
}
|
||||
|
||||
@@ -164,7 +168,8 @@ class DefaultMethodSecurityExpressionHandlerKotlinTests {
|
||||
)
|
||||
|
||||
assertThat(filtered).isInstanceOf(Array<String>::class.java)
|
||||
val result = (filtered as Array<String>)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = filtered as Array<String>
|
||||
assertThat(result).hasSize(1)
|
||||
assertThat(result).contains("string2")
|
||||
}
|
||||
@@ -185,7 +190,8 @@ class DefaultMethodSecurityExpressionHandlerKotlinTests {
|
||||
)
|
||||
|
||||
assertThat(filtered).isInstanceOf(Array<String>::class.java)
|
||||
val result = (filtered as Array<String>)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = filtered as Array<String>
|
||||
assertThat(result).hasSize(0)
|
||||
}
|
||||
|
||||
@@ -209,6 +215,7 @@ class DefaultMethodSecurityExpressionHandlerKotlinTests {
|
||||
)
|
||||
|
||||
assertThat(filtered).isInstanceOf(Stream::class.java)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = (filtered as Stream<String>).toList()
|
||||
assertThat(result).hasSize(1)
|
||||
assertThat(result).contains("string2")
|
||||
@@ -230,6 +237,7 @@ class DefaultMethodSecurityExpressionHandlerKotlinTests {
|
||||
)
|
||||
|
||||
assertThat(filtered).isInstanceOf(Stream::class.java)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val result = (filtered as Stream<String>).toList()
|
||||
assertThat(result).hasSize(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user