diff --git a/acl/src/test/java/org/springframework/security/acls/AclPermissionCacheOptimizerTests.java b/acl/src/test/java/org/springframework/security/acls/AclPermissionCacheOptimizerTests.java index 97d7f4f7219..337df76d5c6 100644 --- a/acl/src/test/java/org/springframework/security/acls/AclPermissionCacheOptimizerTests.java +++ b/acl/src/test/java/org/springframework/security/acls/AclPermissionCacheOptimizerTests.java @@ -34,7 +34,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Luke Taylor @@ -68,7 +68,7 @@ public void ignoresEmptyCollection() { pco.setObjectIdentityRetrievalStrategy(oids); pco.setSidRetrievalStrategy(sids); pco.cachePermissionsFor(mock(Authentication.class), Collections.emptyList()); - verifyZeroInteractions(service, sids, oids); + verifyNoMoreInteractions(service, sids, oids); } } diff --git a/config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java b/config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java index e2e8f2cd00b..cd4ab525a76 100644 --- a/config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java +++ b/config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java @@ -34,7 +34,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Luke Taylor @@ -89,7 +89,7 @@ public void initDoesNotLogErrorWhenFilterChainProxyFailsToLoad() throws Exceptio ReflectionTestUtils.setField(handler, "logger", logger); expectClassUtilsForNameThrowsNoClassDefFoundError(className); handler.init(); - verifyZeroInteractions(logger); + verifyNoMoreInteractions(logger); } @Test diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/OAuth2ClientConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/OAuth2ClientConfigurationTests.java index d540ac3f309..c3870a17355 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/OAuth2ClientConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/OAuth2ClientConfigurationTests.java @@ -56,7 +56,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; @@ -102,7 +102,7 @@ public void requestWhenAuthorizedClientFoundThenMethodArgumentResolved() throws .andExpect(status().isOk()) .andExpect(content().string("resolved")); // @formatter:on - verifyZeroInteractions(accessTokenResponseClient); + verifyNoMoreInteractions(accessTokenResponseClient); } @Test diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java index 9528339f8ae..fef1e21f513 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java @@ -56,7 +56,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; @@ -128,7 +128,7 @@ public void rememberMeLoginWhenAuthenticationSuccessHandlerDeclaredThenUses() th AuthSuccessConfig.SUCCESS_HANDLER = mock(AuthenticationSuccessHandler.class); this.spring.register(AuthSuccessConfig.class).autowire(); MvcResult result = this.mvc.perform(post("/login").with(rememberMeLogin())).andReturn(); - verifyZeroInteractions(AuthSuccessConfig.SUCCESS_HANDLER); + verifyNoMoreInteractions(AuthSuccessConfig.SUCCESS_HANDLER); Cookie rememberMe = result.getResponse().getCookie("remember-me"); assertThat(rememberMe).isNotNull(); this.mvc.perform(get("/somewhere").cookie(rememberMe)); diff --git a/config/src/test/java/org/springframework/security/config/http/DefaultFilterChainValidatorTests.java b/config/src/test/java/org/springframework/security/config/http/DefaultFilterChainValidatorTests.java index e84421a2b47..f9ae480dec3 100644 --- a/config/src/test/java/org/springframework/security/config/http/DefaultFilterChainValidatorTests.java +++ b/config/src/test/java/org/springframework/security/config/http/DefaultFilterChainValidatorTests.java @@ -44,7 +44,6 @@ import org.springframework.test.util.ReflectionTestUtils; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.willThrow; import static org.mockito.Mockito.atLeastOnce; @@ -103,7 +102,7 @@ public void setUp() { @Test public void validateCheckLoginPageIsntProtectedThrowsIllegalArgumentException() { IllegalArgumentException toBeThrown = new IllegalArgumentException("failed to eval expression"); - willThrow(toBeThrown).given(this.accessDecisionManager).decide(any(Authentication.class), anyObject(), + willThrow(toBeThrown).given(this.accessDecisionManager).decide(any(Authentication.class), any(), any(Collection.class)); this.validator.validate(this.chain); verify(this.logger).info( diff --git a/config/src/test/java/org/springframework/security/config/http/WebConfigUtilsTests.java b/config/src/test/java/org/springframework/security/config/http/WebConfigUtilsTests.java index 3682195fde8..567c1d6880c 100644 --- a/config/src/test/java/org/springframework/security/config/http/WebConfigUtilsTests.java +++ b/config/src/test/java/org/springframework/security/config/http/WebConfigUtilsTests.java @@ -23,7 +23,7 @@ import org.springframework.beans.factory.xml.ParserContext; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; @ExtendWith(MockitoExtension.class) public class WebConfigUtilsTests { @@ -38,7 +38,7 @@ public class WebConfigUtilsTests { public void validateHttpRedirectSpELNoParserWarning() { WebConfigUtils.validateHttpRedirect("#{T(org.springframework.security.config.http.WebConfigUtilsTest).URL}", this.parserContext, "fakeSource"); - verifyZeroInteractions(this.parserContext); + verifyNoMoreInteractions(this.parserContext); } } diff --git a/config/src/test/java/org/springframework/security/config/web/server/FormLoginTests.java b/config/src/test/java/org/springframework/security/config/web/server/FormLoginTests.java index f737516bf2f..3e9f76551d6 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/FormLoginTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/FormLoginTests.java @@ -53,7 +53,7 @@ import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.springframework.security.config.Customizer.withDefaults; /** @@ -294,7 +294,7 @@ public void customAuthenticationManager() { .submit(HomePage.class); // @formatter:on homePage.assertAt(); - verifyZeroInteractions(defaultAuthenticationManager); + verifyNoMoreInteractions(defaultAuthenticationManager); } @Test diff --git a/config/src/test/java/org/springframework/security/config/web/server/ServerHttpSecurityTests.java b/config/src/test/java/org/springframework/security/config/web/server/ServerHttpSecurityTests.java index be097e4b07c..a05f9fe846e 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/ServerHttpSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/ServerHttpSecurityTests.java @@ -85,7 +85,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.springframework.security.config.Customizer.withDefaults; /** @@ -409,7 +409,7 @@ public void basicWithCustomAuthenticationManager() { .expectStatus().isOk() .expectBody(String.class).consumeWith((b) -> assertThat(b.getResponseBody()).isEqualTo("ok")); // @formatter:on - verifyZeroInteractions(this.authenticationManager); + verifyNoMoreInteractions(this.authenticationManager); } @Test @@ -438,7 +438,7 @@ public void requestWhenBasicWithAuthenticationManagerInLambdaThenAuthenticationM .expectStatus().isOk() .expectBody(String.class).consumeWith((b) -> assertThat(b.getResponseBody()).isEqualTo("ok")); // @formatter:on - verifyZeroInteractions(this.authenticationManager); + verifyNoMoreInteractions(this.authenticationManager); verify(customAuthenticationManager).authenticate(any(Authentication.class)); } diff --git a/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityInterceptorTests.java b/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityInterceptorTests.java index a5096f83af8..7cb627c1697 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityInterceptorTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityInterceptorTests.java @@ -57,7 +57,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests {@link MethodSecurityInterceptor}. @@ -318,7 +318,7 @@ public void afterInvocationManagerIsNotInvokedIfExceptionIsRaised() throws Throw this.interceptor.setAfterInvocationManager(aim); given(mi.proceed()).willThrow(new Throwable()); assertThatExceptionOfType(Throwable.class).isThrownBy(() -> this.interceptor.invoke(mi)); - verifyZeroInteractions(aim); + verifyNoMoreInteractions(aim); } void mdsReturnsNull() { diff --git a/core/src/test/java/org/springframework/security/access/intercept/aspectj/AspectJMethodSecurityInterceptorTests.java b/core/src/test/java/org/springframework/security/access/intercept/aspectj/AspectJMethodSecurityInterceptorTests.java index cb7f742259d..21417d78a7f 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/aspectj/AspectJMethodSecurityInterceptorTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/aspectj/AspectJMethodSecurityInterceptorTests.java @@ -53,7 +53,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests {@link AspectJMethodSecurityInterceptor}. @@ -154,7 +154,7 @@ public void afterInvocationManagerIsNotInvokedIfExceptionIsRaised() { given(this.aspectJCallback.proceedWithObject()).willThrow(new RuntimeException()); assertThatExceptionOfType(RuntimeException.class) .isThrownBy(() -> this.interceptor.invoke(this.joinPoint, this.aspectJCallback)); - verifyZeroInteractions(aim); + verifyNoMoreInteractions(aim); } // SEC-1967 diff --git a/core/src/test/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisherTests.java b/core/src/test/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisherTests.java index 0010f964310..2eec7d4e9e0 100644 --- a/core/src/test/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisherTests.java +++ b/core/src/test/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisherTests.java @@ -44,7 +44,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; /** * @author Luke Taylor @@ -132,7 +131,7 @@ public void unknownFailureExceptionIsIgnored() { this.publisher.setApplicationEventPublisher(appPublisher); this.publisher.publishAuthenticationFailure(new AuthenticationException("") { }, mock(Authentication.class)); - verifyZeroInteractions(appPublisher); + verifyNoMoreInteractions(appPublisher); } @Test diff --git a/core/src/test/java/org/springframework/security/authentication/UserDetailsRepositoryReactiveAuthenticationManagerTests.java b/core/src/test/java/org/springframework/security/authentication/UserDetailsRepositoryReactiveAuthenticationManagerTests.java index c8f39d52e38..b7cdf7989fe 100644 --- a/core/src/test/java/org/springframework/security/authentication/UserDetailsRepositoryReactiveAuthenticationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authentication/UserDetailsRepositoryReactiveAuthenticationManagerTests.java @@ -42,7 +42,7 @@ import static org.mockito.BDDMockito.willThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -128,7 +128,7 @@ public void authenticateWhenPasswordServiceAndBadCredentialsThenNotUpdated() { this.user.getPassword()); assertThatExceptionOfType(BadCredentialsException.class) .isThrownBy(() -> this.manager.authenticate(token).block()); - verifyZeroInteractions(this.userDetailsPasswordService); + verifyNoMoreInteractions(this.userDetailsPasswordService); } @Test @@ -141,7 +141,7 @@ public void authenticateWhenPasswordServiceAndUpgradeFalseThenNotUpdated() { UsernamePasswordAuthenticationToken token = UsernamePasswordAuthenticationToken.unauthenticated(this.user, this.user.getPassword()); Authentication result = this.manager.authenticate(token).block(); - verifyZeroInteractions(this.userDetailsPasswordService); + verifyNoMoreInteractions(this.userDetailsPasswordService); } @Test @@ -165,7 +165,7 @@ public void authenticateWhenPostAuthenticationChecksNotSet() { UsernamePasswordAuthenticationToken token = UsernamePasswordAuthenticationToken.unauthenticated(this.user, this.user.getPassword()); this.manager.authenticate(token).block(); - verifyZeroInteractions(this.postAuthenticationChecks); + verifyNoMoreInteractions(this.postAuthenticationChecks); } @Test diff --git a/core/src/test/java/org/springframework/security/authentication/dao/DaoAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/dao/DaoAuthenticationProviderTests.java index 5d523c2a3e7..08db0ef4741 100644 --- a/core/src/test/java/org/springframework/security/authentication/dao/DaoAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/dao/DaoAuthenticationProviderTests.java @@ -61,7 +61,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests {@link DaoAuthenticationProvider}. @@ -302,7 +302,7 @@ public void authenticateWhenBadCredentialsAndPasswordManagerThenNoUpdate() { given(encoder.matches(any(), any())).willReturn(false); given(userDetailsService.loadUserByUsername(any())).willReturn(user); assertThatExceptionOfType(BadCredentialsException.class).isThrownBy(() -> provider.authenticate(token)); - verifyZeroInteractions(passwordManager); + verifyNoMoreInteractions(passwordManager); } @Test @@ -321,7 +321,7 @@ public void authenticateWhenNotUpgradeAndPasswordManagerThenNoUpdate() { given(encoder.upgradeEncoding(any())).willReturn(false); given(userDetailsService.loadUserByUsername(any())).willReturn(user); Authentication result = provider.authenticate(token); - verifyZeroInteractions(passwordManager); + verifyNoMoreInteractions(passwordManager); } @Test diff --git a/core/src/test/java/org/springframework/security/core/SpringSecurityCoreVersionTests.java b/core/src/test/java/org/springframework/security/core/SpringSecurityCoreVersionTests.java index fe2bfbadb13..a9f9bfdbd36 100644 --- a/core/src/test/java/org/springframework/security/core/SpringSecurityCoreVersionTests.java +++ b/core/src/test/java/org/springframework/security/core/SpringSecurityCoreVersionTests.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Checks that the embedded version information is up to date. @@ -94,7 +94,7 @@ public void noLoggingIfVersionsAreEqual() throws Exception { expectSpringSecurityVersionThenReturn(version); expectSpringVersionThenReturn(version); performChecks(); - verifyZeroInteractions(this.logger); + verifyNoMoreInteractions(this.logger); } @Test @@ -103,7 +103,7 @@ public void noLoggingIfSpringVersionNull() throws Exception { expectSpringSecurityVersionThenReturn(version); expectSpringVersionThenReturn(null); performChecks(); - verifyZeroInteractions(this.logger); + verifyNoMoreInteractions(this.logger); } @Test @@ -139,7 +139,7 @@ public void noLoggingIfPropertySet() throws Exception { expectSpringVersionThenReturn("2"); System.setProperty(getDisableChecksProperty(), Boolean.TRUE.toString()); performChecks(); - verifyZeroInteractions(this.logger); + verifyNoMoreInteractions(this.logger); } private String getDisableChecksProperty() { diff --git a/crypto/src/test/java/org/springframework/security/crypto/password/DelegatingPasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/password/DelegatingPasswordEncoderTests.java index 48dd89e28c1..898b6df90c6 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/password/DelegatingPasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/password/DelegatingPasswordEncoderTests.java @@ -31,7 +31,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -150,7 +150,7 @@ public void matchesWhenCustomDefaultPasswordEncoderForMatchesThenDelegates() { this.passwordEncoder.setDefaultPasswordEncoderForMatches(this.invalidId); assertThat(this.passwordEncoder.matches(this.rawPassword, encodedPassword)).isFalse(); verify(this.invalidId).matches(this.rawPassword, encodedPassword); - verifyZeroInteractions(this.bcrypt, this.noop); + verifyNoMoreInteractions(this.bcrypt, this.noop); } @Test @@ -170,7 +170,7 @@ public void matchesWhenBCryptThenDelegatesToBCrypt() { given(this.bcrypt.matches(this.rawPassword, this.encodedPassword)).willReturn(true); assertThat(this.passwordEncoder.matches(this.rawPassword, this.bcryptEncodedPassword)).isTrue(); verify(this.bcrypt).matches(this.rawPassword, this.encodedPassword); - verifyZeroInteractions(this.noop); + verifyNoMoreInteractions(this.noop); } @Test @@ -178,7 +178,7 @@ public void matchesWhenBCryptBySpecifyDelegatingPasswordEncoderThenDelegatesToBC given(this.bcrypt.matches(this.rawPassword, this.encodedPassword)).willReturn(true); assertThat(this.onlySuffixPasswordEncoder.matches(this.rawPassword, "bcrypt$" + this.encodedPassword)).isTrue(); verify(this.bcrypt).matches(this.rawPassword, this.encodedPassword); - verifyZeroInteractions(this.noop); + verifyNoMoreInteractions(this.noop); } @Test @@ -186,7 +186,7 @@ public void matchesWhenNoopThenDelegatesToNoop() { given(this.noop.matches(this.rawPassword, this.encodedPassword)).willReturn(true); assertThat(this.passwordEncoder.matches(this.rawPassword, this.noopEncodedPassword)).isTrue(); verify(this.noop).matches(this.rawPassword, this.encodedPassword); - verifyZeroInteractions(this.bcrypt); + verifyNoMoreInteractions(this.bcrypt); } @Test @@ -194,7 +194,7 @@ public void matchesWhenUnMappedThenIllegalArgumentException() { assertThatIllegalArgumentException() .isThrownBy(() -> this.passwordEncoder.matches(this.rawPassword, "{unmapped}" + this.rawPassword)) .withMessage("There is no PasswordEncoder mapped for the id \"unmapped\""); - verifyZeroInteractions(this.bcrypt, this.noop); + verifyNoMoreInteractions(this.bcrypt, this.noop); } @Test @@ -202,7 +202,7 @@ public void matchesWhenNoClosingPrefixStringThenIllegalArgumentException() { assertThatIllegalArgumentException() .isThrownBy(() -> this.passwordEncoder.matches(this.rawPassword, "{bcrypt" + this.rawPassword)) .withMessage("There is no PasswordEncoder mapped for the id \"null\""); - verifyZeroInteractions(this.bcrypt, this.noop); + verifyNoMoreInteractions(this.bcrypt, this.noop); } @Test @@ -210,7 +210,7 @@ public void matchesWhenNoStartingPrefixStringThenFalse() { assertThatIllegalArgumentException() .isThrownBy(() -> this.passwordEncoder.matches(this.rawPassword, "bcrypt}" + this.rawPassword)) .withMessage("There is no PasswordEncoder mapped for the id \"null\""); - verifyZeroInteractions(this.bcrypt, this.noop); + verifyNoMoreInteractions(this.bcrypt, this.noop); } @Test @@ -218,7 +218,7 @@ public void matchesWhenNoIdStringThenFalse() { assertThatIllegalArgumentException() .isThrownBy(() -> this.passwordEncoder.matches(this.rawPassword, "{}" + this.rawPassword)) .withMessage("There is no PasswordEncoder mapped for the id \"\""); - verifyZeroInteractions(this.bcrypt, this.noop); + verifyNoMoreInteractions(this.bcrypt, this.noop); } @Test @@ -228,7 +228,7 @@ public void matchesWhenPrefixInMiddleThenFalse() { () -> this.passwordEncoder.matches(this.rawPassword, "invalid" + this.bcryptEncodedPassword)) .isInstanceOf(IllegalArgumentException.class) .withMessage("There is no PasswordEncoder mapped for the id \"null\""); - verifyZeroInteractions(this.bcrypt, this.noop); + verifyNoMoreInteractions(this.bcrypt, this.noop); } @Test @@ -238,7 +238,7 @@ public void matchesWhenIdIsNullThenFalse() { assertThatIllegalArgumentException() .isThrownBy(() -> passwordEncoder.matches(this.rawPassword, this.rawPassword)) .withMessage("There is no PasswordEncoder mapped for the id \"null\""); - verifyZeroInteractions(this.bcrypt, this.noop); + verifyNoMoreInteractions(this.bcrypt, this.noop); } @Test @@ -248,7 +248,7 @@ public void matchesWhenNullIdThenDelegatesToInvalidId() { given(this.invalidId.matches(this.rawPassword, this.encodedPassword)).willReturn(true); assertThat(this.passwordEncoder.matches(this.rawPassword, this.encodedPassword)).isTrue(); verify(this.invalidId).matches(this.rawPassword, this.encodedPassword); - verifyZeroInteractions(this.bcrypt, this.noop); + verifyNoMoreInteractions(this.bcrypt, this.noop); } @Test @@ -287,7 +287,7 @@ public void upgradeEncodingWhenSameIdAndEncoderTrueThenEncoderDecidesTrue() { @Test public void upgradeEncodingWhenDifferentIdThenTrue() { assertThat(this.passwordEncoder.upgradeEncoding(this.noopEncodedPassword)).isTrue(); - verifyZeroInteractions(this.bcrypt); + verifyNoMoreInteractions(this.bcrypt); } } diff --git a/dependencies/spring-security-dependencies.gradle b/dependencies/spring-security-dependencies.gradle index 46ef739396b..94db7ee6371 100644 --- a/dependencies/spring-security-dependencies.gradle +++ b/dependencies/spring-security-dependencies.gradle @@ -11,6 +11,7 @@ dependencies { api platform("io.projectreactor:reactor-bom:2022.0.0-M4") api platform("io.rsocket:rsocket-bom:1.1.2") api platform("org.junit:junit-bom:5.9.0-RC1") + api platform("org.mockito:mockito-bom:4.7.0") api platform("org.springframework.data:spring-data-bom:2022.0.0-M5") api platform("org.jetbrains.kotlin:kotlin-bom:$kotlinVersion") api platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4") @@ -54,9 +55,16 @@ dependencies { api "org.hibernate.orm:hibernate-core:6.1.1.Final" api "org.hsqldb:hsqldb:2.6.1" api "org.jasig.cas.client:cas-client-core:3.6.4" +<<<<<<< HEAD api "org.mockito:mockito-core:3.12.4" api "org.mockito:mockito-inline:3.12.4" api "org.mockito:mockito-junit-jupiter:3.12.4" +<<<<<<< HEAD +======= + api "org.openid4java:openid4java-nodeps:0.9.6" +======= +>>>>>>> 8e018fd921 (Update to mockito 4.7.0) +>>>>>>> 5.8.x api "org.opensaml:opensaml-core:$openSamlVersion" api "org.opensaml:opensaml-saml-api:$openSamlVersion" api "org.opensaml:opensaml-saml-impl:$openSamlVersion" diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestRedirectFilterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestRedirectFilterTests.java index e2d74aa7811..e9a858973b1 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestRedirectFilterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestRedirectFilterTests.java @@ -53,7 +53,7 @@ import static org.mockito.BDDMockito.willThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests for {@link OAuth2AuthorizationRequestRedirectFilter}. @@ -138,7 +138,7 @@ public void doFilterWhenAuthorizationRequestWithInvalidClientThenStatusInternalS MockHttpServletResponse response = new MockHttpServletResponse(); FilterChain filterChain = mock(FilterChain.class); this.filter.doFilter(request, response, filterChain); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR.value()); assertThat(response.getErrorMessage()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase()); } @@ -152,7 +152,7 @@ public void doFilterWhenAuthorizationRequestOAuth2LoginThenRedirectForAuthorizat MockHttpServletResponse response = new MockHttpServletResponse(); FilterChain filterChain = mock(FilterChain.class); this.filter.doFilter(request, response, filterChain); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); assertThat(response.getRedirectedUrl()).matches("https://example.com/login/oauth/authorize\\?" + "response_type=code&client_id=client-id&" + "scope=read:user&state=.{15,}&" + "redirect_uri=http://localhost/login/oauth2/code/registration-id"); @@ -170,7 +170,7 @@ public void doFilterWhenAuthorizationRequestOAuth2LoginThenAuthorizationRequestS AuthorizationRequestRepository.class); this.filter.setAuthorizationRequestRepository(authorizationRequestRepository); this.filter.doFilter(request, response, filterChain); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); verify(authorizationRequestRepository).saveAuthorizationRequest(any(OAuth2AuthorizationRequest.class), any(HttpServletRequest.class), any(HttpServletResponse.class)); } @@ -186,7 +186,7 @@ public void doFilterWhenCustomAuthorizationRequestBaseUriThenRedirectForAuthoriz MockHttpServletResponse response = new MockHttpServletResponse(); FilterChain filterChain = mock(FilterChain.class); this.filter.doFilter(request, response, filterChain); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); assertThat(response.getRedirectedUrl()).matches("https://example.com/login/oauth/authorize\\?" + "response_type=code&client_id=client-id&" + "scope=read:user&state=.{15,}&" + "redirect_uri=http://localhost/login/oauth2/code/registration-id"); @@ -224,7 +224,7 @@ public void doFilterWhenNotAuthorizationRequestAndClientAuthorizationRequiredExc OAuth2AuthorizationRequestRedirectFilter filter = new OAuth2AuthorizationRequestRedirectFilter(resolver); filter.doFilter(request, response, filterChain); verify(filterChain).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class)); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR.value()); assertThat(response.getErrorMessage()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase()); } @@ -250,7 +250,7 @@ public void doFilterWhenAuthorizationRequestAndAdditionalParametersProvidedThenA given(resolver.resolve(any())).willReturn(result); OAuth2AuthorizationRequestRedirectFilter filter = new OAuth2AuthorizationRequestRedirectFilter(resolver); filter.doFilter(request, response, filterChain); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); assertThat(response.getRedirectedUrl()).matches("https://example.com/login/oauth/authorize\\?" + "response_type=code&client_id=client-id&" + "scope=read:user&state=.{15,}&" + "redirect_uri=http://localhost/login/oauth2/code/registration-id&" @@ -291,7 +291,7 @@ public void doFilterWhenAuthorizationRequestAndCustomAuthorizationRequestUriSetT given(resolver.resolve(any())).willReturn(result); OAuth2AuthorizationRequestRedirectFilter filter = new OAuth2AuthorizationRequestRedirectFilter(resolver); filter.doFilter(request, response, filterChain); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); assertThat(response.getRedirectedUrl()).matches("https://example.com/login/oauth/authorize\\?" + "response_type=code&client_id=client-id&" + "scope=read:user&state=.{15,}&" + "redirect_uri=http://localhost/login/oauth2/code/registration-id&" @@ -316,7 +316,7 @@ public void doFilterWhenCustomAuthorizationRedirectStrategySetThenCustomAuthoriz }; this.filter.setAuthorizationRedirectStrategy(customRedirectStrategy); this.filter.doFilter(request, response, filterChain); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); assertThat(response.getContentType()).isEqualTo(MediaType.TEXT_PLAIN_VALUE); assertThat(response.getContentAsString(StandardCharsets.UTF_8)) diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilterTests.java index 3a22224e4b7..07c236cd8f9 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilterTests.java @@ -68,7 +68,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests for {@link OAuth2LoginAuthenticationFilter}. @@ -309,7 +309,7 @@ public void doFilterWhenCustomFilterProcessesUrlThenFilterProcesses() throws Exc this.setUpAuthorizationRequest(request, response, this.registration2, state); this.setUpAuthenticationResult(this.registration2); this.filter.doFilter(request, response, filterChain); - verifyZeroInteractions(filterChain); + verifyNoMoreInteractions(filterChain); verify(this.filter).attemptAuthentication(any(HttpServletRequest.class), any(HttpServletResponse.class)); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionTests.java index 128dec8880b..9bc94651349 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionTests.java @@ -114,7 +114,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -822,7 +822,7 @@ public void filterWhenDefaultOAuth2AuthorizedClientFalseThenEmpty() { // @formatter:on List requests = this.exchange.getRequests(); assertThat(requests).hasSize(1); - verifyZeroInteractions(this.clientRegistrationRepository, this.authorizedClientRepository); + verifyNoMoreInteractions(this.clientRegistrationRepository, this.authorizedClientRepository); } @Test diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadInterceptorRSocketTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadInterceptorRSocketTests.java index 963698b8572..3d1e81c1f1f 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadInterceptorRSocketTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadInterceptorRSocketTests.java @@ -66,7 +66,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -191,7 +191,7 @@ public void requestResponseWhenInterceptorErrorsThenDelegateNotInvoked() { .isThrownBy(() -> interceptor.requestResponse(this.payload).block()).isEqualTo(expected); verify(this.interceptor).intercept(this.exchange.capture(), any()); assertThat(this.exchange.getValue().getPayload()).isEqualTo(this.payload); - verifyZeroInteractions(this.delegate); + verifyNoMoreInteractions(this.delegate); } @Test @@ -442,7 +442,7 @@ public void fireAndForgetWhenInterceptor1ErrorsThenInterceptor2AndDelegateNotInv .isThrownBy(() -> interceptor.fireAndForget(this.payload).block()).isEqualTo(expected); verify(this.interceptor).intercept(this.exchange.capture(), any()); assertThat(this.exchange.getValue().getPayload()).isEqualTo(this.payload); - verifyZeroInteractions(this.interceptor2); + verifyNoMoreInteractions(this.interceptor2); this.voidResult.assertWasNotSubscribed(); } diff --git a/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java b/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java index fe0b77e581f..16f65811529 100644 --- a/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java +++ b/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java @@ -52,7 +52,7 @@ import static org.mockito.BDDMockito.willThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Luke Taylor @@ -108,7 +108,7 @@ public void securityFilterChainIsNotInvokedIfMatchFails() throws Exception { this.fcp.doFilter(this.request, this.response, this.chain); assertThat(this.fcp.getFilterChains()).hasSize(1); assertThat(this.fcp.getFilterChains().get(0).getFilters().get(0)).isSameAs(this.filter); - verifyZeroInteractions(this.filter); + verifyNoMoreInteractions(this.filter); // The actual filter chain should be invoked though verify(this.chain).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class)); } @@ -146,7 +146,7 @@ public void requestIsWrappedForMatchingAndFilteringWhenMatchIsNotFound() throws given(this.matcher.matches(any(HttpServletRequest.class))).willReturn(false); this.fcp.doFilter(this.request, this.response, this.chain); verify(this.matcher).matches(any(FirewalledRequest.class)); - verifyZeroInteractions(this.filter); + verifyNoMoreInteractions(this.filter); verify(this.chain).doFilter(any(FirewalledRequest.class), any(HttpServletResponse.class)); } diff --git a/web/src/test/java/org/springframework/security/web/access/DefaultWebInvocationPrivilegeEvaluatorTests.java b/web/src/test/java/org/springframework/security/web/access/DefaultWebInvocationPrivilegeEvaluatorTests.java index e71e0ff65da..9e5b84e7f94 100644 --- a/web/src/test/java/org/springframework/security/web/access/DefaultWebInvocationPrivilegeEvaluatorTests.java +++ b/web/src/test/java/org/springframework/security/web/access/DefaultWebInvocationPrivilegeEvaluatorTests.java @@ -36,7 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyList; -import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.willThrow; @@ -76,14 +75,14 @@ public final void setUp() { @Test public void permitsAccessIfNoMatchingAttributesAndPublicInvocationsAllowed() { DefaultWebInvocationPrivilegeEvaluator wipe = new DefaultWebInvocationPrivilegeEvaluator(this.interceptor); - given(this.ods.getAttributes(anyObject())).willReturn(null); + given(this.ods.getAttributes(any())).willReturn(null); assertThat(wipe.isAllowed("/context", "/foo/index.jsp", "GET", mock(Authentication.class))).isTrue(); } @Test public void deniesAccessIfNoMatchingAttributesAndPublicInvocationsNotAllowed() { DefaultWebInvocationPrivilegeEvaluator wipe = new DefaultWebInvocationPrivilegeEvaluator(this.interceptor); - given(this.ods.getAttributes(anyObject())).willReturn(null); + given(this.ods.getAttributes(any())).willReturn(null); this.interceptor.setRejectPublicInvocations(true); assertThat(wipe.isAllowed("/context", "/foo/index.jsp", "GET", mock(Authentication.class))).isFalse(); } @@ -106,8 +105,7 @@ public void allowsAccessIfAccessDecisionManagerDoes() { public void deniesAccessIfAccessDecisionManagerDoes() { Authentication token = new TestingAuthenticationToken("test", "Password", "MOCK_INDEX"); DefaultWebInvocationPrivilegeEvaluator wipe = new DefaultWebInvocationPrivilegeEvaluator(this.interceptor); - willThrow(new AccessDeniedException("")).given(this.adm).decide(any(Authentication.class), anyObject(), - anyList()); + willThrow(new AccessDeniedException("")).given(this.adm).decide(any(Authentication.class), any(), anyList()); assertThat(wipe.isAllowed("/foo/index.jsp", token)).isFalse(); } diff --git a/web/src/test/java/org/springframework/security/web/access/ExceptionTranslationFilterTests.java b/web/src/test/java/org/springframework/security/web/access/ExceptionTranslationFilterTests.java index 86e3ec9bcea..b7466561caa 100644 --- a/web/src/test/java/org/springframework/security/web/access/ExceptionTranslationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/access/ExceptionTranslationFilterTests.java @@ -54,7 +54,7 @@ import static org.mockito.BDDMockito.willThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests {@link ExceptionTranslationFilter}. @@ -283,7 +283,7 @@ public void doFilterWhenResponseCommittedThenRethrowsException() { ExceptionTranslationFilter filter = new ExceptionTranslationFilter(this.mockEntryPoint); assertThatExceptionOfType(ServletException.class).isThrownBy(() -> filter.doFilter(request, response, chain)) .withCauseInstanceOf(AccessDeniedException.class); - verifyZeroInteractions(this.mockEntryPoint); + verifyNoMoreInteractions(this.mockEntryPoint); } @Test diff --git a/web/src/test/java/org/springframework/security/web/access/intercept/FilterSecurityInterceptorTests.java b/web/src/test/java/org/springframework/security/web/access/intercept/FilterSecurityInterceptorTests.java index 16d458b68e9..47ddfc37dfe 100644 --- a/web/src/test/java/org/springframework/security/web/access/intercept/FilterSecurityInterceptorTests.java +++ b/web/src/test/java/org/springframework/security/web/access/intercept/FilterSecurityInterceptorTests.java @@ -52,7 +52,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests {@link FilterSecurityInterceptor}. @@ -137,7 +137,7 @@ public void afterInvocationIsNotInvokedIfExceptionThrown() throws Exception { AfterInvocationManager aim = mock(AfterInvocationManager.class); this.interceptor.setAfterInvocationManager(aim); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> this.interceptor.invoke(fi)); - verifyZeroInteractions(aim); + verifyNoMoreInteractions(aim); } // SEC-1967 diff --git a/web/src/test/java/org/springframework/security/web/authentication/AuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/AuthenticationFilterTests.java index 37eadafb388..be1628aae2c 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/AuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/AuthenticationFilterTests.java @@ -52,7 +52,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Sergey Bespalov @@ -96,7 +96,7 @@ public void filterWhenDefaultsAndNoAuthenticationThenContinues() throws Exceptio MockHttpServletResponse response = new MockHttpServletResponse(); FilterChain chain = mock(FilterChain.class); filter.doFilter(request, response, chain); - verifyZeroInteractions(this.authenticationManager); + verifyNoMoreInteractions(this.authenticationManager); verify(chain).doFilter(any(ServletRequest.class), any(ServletResponse.class)); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } @@ -109,7 +109,7 @@ public void filterWhenAuthenticationManagerResolverDefaultsAndNoAuthenticationTh MockHttpServletResponse response = new MockHttpServletResponse(); FilterChain chain = mock(FilterChain.class); filter.doFilter(request, response, chain); - verifyZeroInteractions(this.authenticationManagerResolver); + verifyNoMoreInteractions(this.authenticationManagerResolver); verify(chain).doFilter(any(ServletRequest.class), any(ServletResponse.class)); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } @@ -207,7 +207,7 @@ public void filterWhenConvertEmptyThenOk() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/"); FilterChain chain = mock(FilterChain.class); filter.doFilter(request, new MockHttpServletResponse(), chain); - verifyZeroInteractions(this.authenticationManagerResolver); + verifyNoMoreInteractions(this.authenticationManagerResolver); verify(chain).doFilter(any(ServletRequest.class), any(ServletResponse.class)); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } @@ -226,7 +226,7 @@ public void filterWhenConvertAndAuthenticationSuccessThenSuccess() throws Except FilterChain chain = mock(FilterChain.class); filter.doFilter(request, response, chain); verify(this.successHandler).onAuthenticationSuccess(any(), any(), any(), eq(authentication)); - verifyZeroInteractions(this.failureHandler); + verifyNoMoreInteractions(this.failureHandler); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNotNull(); } @@ -243,7 +243,7 @@ public void filterWhenConvertAndAuthenticationEmptyThenServerError() throws Exce MockHttpServletResponse response = new MockHttpServletResponse(); FilterChain chain = mock(FilterChain.class); assertThatExceptionOfType(ServletException.class).isThrownBy(() -> filter.doFilter(request, response, chain)); - verifyZeroInteractions(this.successHandler); + verifyNoMoreInteractions(this.successHandler); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } @@ -257,7 +257,7 @@ public void filterWhenNotMatchAndConvertAndAuthenticationSuccessThenContinues() MockHttpServletResponse response = new MockHttpServletResponse(); FilterChain chain = mock(FilterChain.class); filter.doFilter(request, response, chain); - verifyZeroInteractions(this.authenticationConverter, this.authenticationManagerResolver, this.successHandler); + verifyNoMoreInteractions(this.authenticationConverter, this.authenticationManagerResolver, this.successHandler); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationFailureHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationFailureHandlerTests.java index 32548e2ed00..14df79f1a02 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationFailureHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationFailureHandlerTests.java @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Test class for @@ -76,7 +76,7 @@ public void handleByDefaultHandler() throws Exception { this.handler = new DelegatingAuthenticationFailureHandler(this.handlers, this.defaultHandler); AuthenticationException exception = new AccountExpiredException(""); this.handler.onAuthenticationFailure(this.request, this.response, exception); - verifyZeroInteractions(this.handler1, this.handler2); + verifyNoMoreInteractions(this.handler1, this.handler2); verify(this.defaultHandler).onAuthenticationFailure(this.request, this.response, exception); } @@ -87,7 +87,7 @@ public void handleByMappedHandlerWithSameType() throws Exception { this.handler = new DelegatingAuthenticationFailureHandler(this.handlers, this.defaultHandler); AuthenticationException exception = new BadCredentialsException(""); this.handler.onAuthenticationFailure(this.request, this.response, exception); - verifyZeroInteractions(this.handler2, this.defaultHandler); + verifyNoMoreInteractions(this.handler2, this.defaultHandler); verify(this.handler1).onAuthenticationFailure(this.request, this.response, exception); } @@ -99,7 +99,7 @@ public void handleByMappedHandlerWithSuperType() throws Exception { this.handler = new DelegatingAuthenticationFailureHandler(this.handlers, this.defaultHandler); AuthenticationException exception = new CredentialsExpiredException(""); this.handler.onAuthenticationFailure(this.request, this.response, exception); - verifyZeroInteractions(this.handler1, this.defaultHandler); + verifyNoMoreInteractions(this.handler1, this.defaultHandler); verify(this.handler2).onAuthenticationFailure(this.request, this.response, exception); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/DelegatingLogoutSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/DelegatingLogoutSuccessHandlerTests.java index c632b48e3af..e5c69ab3594 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/DelegatingLogoutSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/DelegatingLogoutSuccessHandlerTests.java @@ -31,7 +31,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * DelegatingLogoutSuccessHandlerTests Tests @@ -82,7 +82,7 @@ public void onLogoutSuccessFirstMatches() throws Exception { given(this.matcher.matches(this.request)).willReturn(true); this.delegatingHandler.onLogoutSuccess(this.request, this.response, this.authentication); verify(this.handler).onLogoutSuccess(this.request, this.response, this.authentication); - verifyZeroInteractions(this.matcher2, this.handler2, this.defaultHandler); + verifyNoMoreInteractions(this.matcher2, this.handler2, this.defaultHandler); } @Test @@ -91,7 +91,7 @@ public void onLogoutSuccessSecondMatches() throws Exception { given(this.matcher2.matches(this.request)).willReturn(true); this.delegatingHandler.onLogoutSuccess(this.request, this.response, this.authentication); verify(this.handler2).onLogoutSuccess(this.request, this.response, this.authentication); - verifyZeroInteractions(this.handler, this.defaultHandler); + verifyNoMoreInteractions(this.handler, this.defaultHandler); } @Test @@ -99,13 +99,13 @@ public void onLogoutSuccessDefault() throws Exception { this.delegatingHandler.setDefaultLogoutSuccessHandler(this.defaultHandler); this.delegatingHandler.onLogoutSuccess(this.request, this.response, this.authentication); verify(this.defaultHandler).onLogoutSuccess(this.request, this.response, this.authentication); - verifyZeroInteractions(this.handler, this.handler2); + verifyNoMoreInteractions(this.handler, this.handler2); } @Test public void onLogoutSuccessNoMatchDefaultNull() throws Exception { this.delegatingHandler.onLogoutSuccess(this.request, this.response, this.authentication); - verifyZeroInteractions(this.handler, this.handler2, this.defaultHandler); + verifyNoMoreInteractions(this.handler, this.handler2, this.defaultHandler); } } diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilterTests.java index 7f812a32b26..4b5482db84d 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilterTests.java @@ -51,7 +51,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -170,7 +170,7 @@ public void requiresAuthenticationFalsePrincipalString() throws Exception { filter.setAuthenticationManager(am); filter.afterPropertiesSet(); filter.doFilter(request, response, chain); - verifyZeroInteractions(am); + verifyNoMoreInteractions(am); } @Test @@ -273,7 +273,7 @@ public void requiresAuthenticationFalsePrincipalNotString() throws Exception { filter.setAuthenticationManager(am); filter.afterPropertiesSet(); filter.doFilter(request, response, chain); - verifyZeroInteractions(am); + verifyNoMoreInteractions(am); } @Test @@ -293,7 +293,7 @@ public void requiresAuthenticationFalsePrincipalUser() throws Exception { filter.setAuthenticationManager(am); filter.afterPropertiesSet(); filter.doFilter(request, response, chain); - verifyZeroInteractions(am); + verifyNoMoreInteractions(am); } @Test @@ -358,7 +358,7 @@ protected boolean principalChanged(HttpServletRequest request, Authentication cu filter.setAuthenticationManager(am); filter.afterPropertiesSet(); filter.doFilter(request, response, chain); - verifyZeroInteractions(am); + verifyNoMoreInteractions(am); } @Test @@ -372,7 +372,7 @@ public void requestNotMatchRequestMatcher() throws Exception { filter.setAuthenticationManager(am); filter.afterPropertiesSet(); filter.doFilter(request, response, chain); - verifyZeroInteractions(am); + verifyNoMoreInteractions(am); } @Test diff --git a/web/src/test/java/org/springframework/security/web/authentication/rememberme/RememberMeAuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/rememberme/RememberMeAuthenticationFilterTests.java index 1ed3fd22212..664e2e1849c 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/rememberme/RememberMeAuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/rememberme/RememberMeAuthenticationFilterTests.java @@ -44,7 +44,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests {@link RememberMeAuthenticationFilter}. @@ -150,7 +150,7 @@ public void authenticationSuccessHandlerIsInvokedOnSuccessfulAuthenticationIfSet filter.doFilter(request, response, fc); assertThat(response.getRedirectedUrl()).isEqualTo("/target"); // Should return after success handler is invoked, so chain should not proceed - verifyZeroInteractions(fc); + verifyNoMoreInteractions(fc); } @Test diff --git a/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationConverterTests.java b/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationConverterTests.java index 1b8473674d6..982b91427f8 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationConverterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationConverterTests.java @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Sergey Bespalov @@ -79,7 +79,7 @@ public void testWhenUnsupportedAuthorizationHeaderThenIgnored() { MockHttpServletRequest request = new MockHttpServletRequest(); request.addHeader("Authorization", "Bearer someOtherToken"); UsernamePasswordAuthenticationToken authentication = this.converter.convert(request); - verifyZeroInteractions(this.authenticationDetailsSource); + verifyNoMoreInteractions(this.authenticationDetailsSource); assertThat(authentication).isNull(); } diff --git a/web/src/test/java/org/springframework/security/web/concurrent/ConcurrentSessionFilterTests.java b/web/src/test/java/org/springframework/security/web/concurrent/ConcurrentSessionFilterTests.java index eea8e93f88b..65a8bcb4009 100644 --- a/web/src/test/java/org/springframework/security/web/concurrent/ConcurrentSessionFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/concurrent/ConcurrentSessionFilterTests.java @@ -51,7 +51,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests {@link ConcurrentSessionFilter}. @@ -110,7 +110,7 @@ public void detectsExpiredSessions() throws Exception { FilterChain fc = mock(FilterChain.class); filter.doFilter(request, response, fc); // Expect that the filter chain will not be invoked, as we redirect to expiredUrl - verifyZeroInteractions(fc); + verifyNoMoreInteractions(fc); assertThat(response.getRedirectedUrl()).isEqualTo("/expired.jsp"); } @@ -127,7 +127,7 @@ public void returnsExpectedMessageWhenNoExpiredUrlSet() throws Exception { ConcurrentSessionFilter filter = new ConcurrentSessionFilter(registry); FilterChain fc = mock(FilterChain.class); filter.doFilter(request, response, fc); - verifyZeroInteractions(fc); + verifyNoMoreInteractions(fc); assertThat(response.getContentAsString()) .isEqualTo("This session has been expired (possibly due to multiple concurrent logins being " + "attempted as the same user)."); diff --git a/web/src/test/java/org/springframework/security/web/csrf/CsrfFilterTests.java b/web/src/test/java/org/springframework/security/web/csrf/CsrfFilterTests.java index a03b8049af8..f5789804f23 100644 --- a/web/src/test/java/org/springframework/security/web/csrf/CsrfFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/csrf/CsrfFilterTests.java @@ -48,7 +48,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -128,7 +128,7 @@ public void doFilterAccessDeniedNoTokenPresent() throws ServletException, IOExce assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.deniedHandler).handle(eq(this.request), eq(this.response), any(InvalidCsrfTokenException.class)); - verifyZeroInteractions(this.filterChain); + verifyNoMoreInteractions(this.filterChain); } @Test @@ -140,7 +140,7 @@ public void doFilterAccessDeniedIncorrectTokenPresent() throws ServletException, assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.deniedHandler).handle(eq(this.request), eq(this.response), any(InvalidCsrfTokenException.class)); - verifyZeroInteractions(this.filterChain); + verifyNoMoreInteractions(this.filterChain); } @Test @@ -152,7 +152,7 @@ public void doFilterAccessDeniedIncorrectTokenPresentHeader() throws ServletExce assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.deniedHandler).handle(eq(this.request), eq(this.response), any(InvalidCsrfTokenException.class)); - verifyZeroInteractions(this.filterChain); + verifyNoMoreInteractions(this.filterChain); } @Test @@ -166,7 +166,7 @@ public void doFilterAccessDeniedIncorrectTokenPresentHeaderPreferredOverParamete assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.deniedHandler).handle(eq(this.request), eq(this.response), any(InvalidCsrfTokenException.class)); - verifyZeroInteractions(this.filterChain); + verifyNoMoreInteractions(this.filterChain); } @Test @@ -177,7 +177,7 @@ public void doFilterNotCsrfRequestExistingToken() throws ServletException, IOExc assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.filterChain).doFilter(this.request, this.response); - verifyZeroInteractions(this.deniedHandler); + verifyNoMoreInteractions(this.deniedHandler); } @Test @@ -188,7 +188,7 @@ public void doFilterNotCsrfRequestGenerateToken() throws ServletException, IOExc assertToken(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertToken(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.filterChain).doFilter(this.request, this.response); - verifyZeroInteractions(this.deniedHandler); + verifyNoMoreInteractions(this.deniedHandler); } @Test @@ -200,7 +200,7 @@ public void doFilterIsCsrfRequestExistingTokenHeader() throws ServletException, assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.filterChain).doFilter(this.request, this.response); - verifyZeroInteractions(this.deniedHandler); + verifyNoMoreInteractions(this.deniedHandler); } @Test @@ -214,7 +214,7 @@ public void doFilterIsCsrfRequestExistingTokenHeaderPreferredOverInvalidParam() assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.filterChain).doFilter(this.request, this.response); - verifyZeroInteractions(this.deniedHandler); + verifyNoMoreInteractions(this.deniedHandler); } @Test @@ -226,7 +226,7 @@ public void doFilterIsCsrfRequestExistingToken() throws ServletException, IOExce assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); verify(this.filterChain).doFilter(this.request, this.response); - verifyZeroInteractions(this.deniedHandler); + verifyNoMoreInteractions(this.deniedHandler); verify(this.tokenRepository, never()).saveToken(any(CsrfToken.class), any(HttpServletRequest.class), any(HttpServletResponse.class)); } @@ -243,7 +243,7 @@ public void doFilterIsCsrfRequestGenerateToken() throws ServletException, IOExce assertThat(this.request.getAttribute(HttpServletResponse.class.getName())).isEqualTo(this.response); verify(this.filterChain).doFilter(this.request, this.response); verify(this.tokenRepository).saveToken(this.token, this.request, this.response); - verifyZeroInteractions(this.deniedHandler); + verifyNoMoreInteractions(this.deniedHandler); } @Test @@ -256,7 +256,7 @@ public void doFilterDefaultRequireCsrfProtectionMatcherAllowedMethods() throws S this.request.setMethod(method); this.filter.doFilter(this.request, this.response, this.filterChain); verify(this.filterChain).doFilter(this.request, this.response); - verifyZeroInteractions(this.deniedHandler); + verifyNoMoreInteractions(this.deniedHandler); } } @@ -277,7 +277,7 @@ public void doFilterDefaultRequireCsrfProtectionMatcherAllowedMethodsCaseSensiti this.filter.doFilter(this.request, this.response, this.filterChain); verify(this.deniedHandler).handle(eq(this.request), eq(this.response), any(InvalidCsrfTokenException.class)); - verifyZeroInteractions(this.filterChain); + verifyNoMoreInteractions(this.filterChain); } } @@ -292,7 +292,7 @@ public void doFilterDefaultRequireCsrfProtectionMatcherDeniedMethods() throws Se this.filter.doFilter(this.request, this.response, this.filterChain); verify(this.deniedHandler).handle(eq(this.request), eq(this.response), any(InvalidCsrfTokenException.class)); - verifyZeroInteractions(this.filterChain); + verifyNoMoreInteractions(this.filterChain); } } @@ -306,7 +306,7 @@ public void doFilterDefaultAccessDenied() throws ServletException, IOException { assertThat(this.request.getAttribute(this.token.getParameterName())).isEqualTo(this.token); assertThat(this.request.getAttribute(CsrfToken.class.getName())).isEqualTo(this.token); assertThat(this.response.getStatus()).isEqualTo(HttpServletResponse.SC_FORBIDDEN); - verifyZeroInteractions(this.filterChain); + verifyNoMoreInteractions(this.filterChain); } @Test @@ -317,7 +317,7 @@ public void doFilterWhenSkipRequestInvokedThenSkips() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); CsrfFilter.skipRequest(request); filter.doFilter(request, new MockHttpServletResponse(), new MockFilterChain()); - verifyZeroInteractions(repository); + verifyNoMoreInteractions(repository); } // gh-9561 diff --git a/web/src/test/java/org/springframework/security/web/csrf/LazyCsrfTokenRepositoryTests.java b/web/src/test/java/org/springframework/security/web/csrf/LazyCsrfTokenRepositoryTests.java index 9be9d96518d..f1c667324b6 100644 --- a/web/src/test/java/org/springframework/security/web/csrf/LazyCsrfTokenRepositoryTests.java +++ b/web/src/test/java/org/springframework/security/web/csrf/LazyCsrfTokenRepositoryTests.java @@ -31,7 +31,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -81,7 +81,7 @@ public void generateTokenGetTokenSavesToken() { @Test public void saveNonNullDoesNothing() { this.repository.saveToken(this.token, this.request, this.response); - verifyZeroInteractions(this.delegate); + verifyNoMoreInteractions(this.delegate); } @Test diff --git a/web/src/test/java/org/springframework/security/web/header/HeaderWriterFilterTests.java b/web/src/test/java/org/springframework/security/web/header/HeaderWriterFilterTests.java index f6b1b30d5b7..c0fc732d0a1 100644 --- a/web/src/test/java/org/springframework/security/web/header/HeaderWriterFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/HeaderWriterFilterTests.java @@ -37,7 +37,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; /** * Tests for the {@code HeadersFilter} @@ -91,7 +90,7 @@ public void headersDelayed() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); filter.doFilter(request, response, (request1, response1) -> { - verifyZeroInteractions(HeaderWriterFilterTests.this.writer1); + verifyNoMoreInteractions(HeaderWriterFilterTests.this.writer1); response1.flushBuffer(); verify(HeaderWriterFilterTests.this.writer1).writeHeaders(any(HttpServletRequest.class), any(HttpServletResponse.class)); @@ -106,7 +105,7 @@ public void doFilterWhenRequestContainsIncludeThenHeadersStillWritten() throws E MockHttpServletRequest mockRequest = new MockHttpServletRequest(); MockHttpServletResponse mockResponse = new MockHttpServletResponse(); filter.doFilter(mockRequest, mockResponse, (request, response) -> { - verifyZeroInteractions(HeaderWriterFilterTests.this.writer1); + verifyNoMoreInteractions(HeaderWriterFilterTests.this.writer1); request.getRequestDispatcher("/").include(request, response); verify(HeaderWriterFilterTests.this.writer1).writeHeaders(any(HttpServletRequest.class), any(HttpServletResponse.class)); diff --git a/web/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java b/web/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java index 73decc437fb..6a19069bdc1 100644 --- a/web/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -59,7 +59,7 @@ public void sendRedirectWhenExchangeNullThenException() { @Test public void sendRedirectWhenNoSubscribersThenNoActions() { this.strategy.sendRedirect(this.exchange, this.location); - verifyZeroInteractions(this.exchange); + verifyNoMoreInteractions(this.exchange); } @Test diff --git a/web/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java index 7f060212166..a0f3b71c33a 100644 --- a/web/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -71,7 +71,7 @@ public void commenceWhenNotMatchThenMatchThenOnlySecondDelegateInvoked() { new DelegateEntry(this.matcher2, this.delegate2)); Mono actualResult = this.entryPoint.commence(this.exchange, this.e); actualResult.block(); - verifyZeroInteractions(this.delegate1); + verifyNoMoreInteractions(this.delegate1); verify(this.delegate2).commence(this.exchange, this.e); } @@ -82,7 +82,7 @@ public void commenceWhenNotMatchThenDefault() { new DelegateEntry(this.matcher1, this.delegate1)); this.entryPoint.commence(this.exchange, this.e).block(); assertThat(this.exchange.getResponse().getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); - verifyZeroInteractions(this.delegate1); + verifyNoMoreInteractions(this.delegate1); } } diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java index 1d8271a8473..a58f87adb1f 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java @@ -42,7 +42,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -88,7 +88,7 @@ public void filterWhenDefaultsAndNoAuthenticationThenContinues() { EntityExchangeResult result = client.get().uri("/").exchange().expectStatus().isOk() .expectBody(String.class).consumeWith((b) -> assertThat(b.getResponseBody()).isEqualTo("ok")) .returnResult(); - verifyZeroInteractions(this.authenticationManager); + verifyNoMoreInteractions(this.authenticationManager); assertThat(result.getResponseCookies()).isEmpty(); } @@ -99,7 +99,7 @@ public void filterWhenAuthenticationManagerResolverDefaultsAndNoAuthenticationTh EntityExchangeResult result = client.get().uri("/").exchange().expectStatus().isOk() .expectBody(String.class).consumeWith((b) -> assertThat(b.getResponseBody()).isEqualTo("ok")) .returnResult(); - verifyZeroInteractions(this.authenticationManagerResolver); + verifyNoMoreInteractions(this.authenticationManagerResolver); assertThat(result.getResponseCookies()).isEmpty(); } @@ -162,7 +162,7 @@ public void filterWhenConvertEmptyThenOk() { client.get().uri("/").exchange().expectStatus().isOk().expectBody(String.class) .consumeWith((b) -> assertThat(b.getResponseBody()).isEqualTo("ok")).returnResult(); verify(this.securityContextRepository, never()).save(any(), any()); - verifyZeroInteractions(this.authenticationManager, this.successHandler, this.failureHandler); + verifyNoMoreInteractions(this.authenticationManager, this.successHandler, this.failureHandler); } @Test @@ -171,7 +171,7 @@ public void filterWhenConvertErrorThenServerError() { WebTestClient client = WebTestClientBuilder.bindToWebFilters(this.filter).build(); client.get().uri("/").exchange().expectStatus().is5xxServerError().expectBody().isEmpty(); verify(this.securityContextRepository, never()).save(any(), any()); - verifyZeroInteractions(this.authenticationManager, this.successHandler, this.failureHandler); + verifyNoMoreInteractions(this.authenticationManager, this.successHandler, this.failureHandler); } @Test @@ -185,7 +185,7 @@ public void filterWhenConvertAndAuthenticationSuccessThenSuccess() { client.get().uri("/").exchange().expectStatus().isOk().expectBody().isEmpty(); verify(this.successHandler).onAuthenticationSuccess(any(), eq(authentication.block())); verify(this.securityContextRepository).save(any(), any()); - verifyZeroInteractions(this.failureHandler); + verifyNoMoreInteractions(this.failureHandler); } @Test @@ -196,7 +196,7 @@ public void filterWhenConvertAndAuthenticationEmptyThenServerError() { WebTestClient client = WebTestClientBuilder.bindToWebFilters(this.filter).build(); client.get().uri("/").exchange().expectStatus().is5xxServerError().expectBody().isEmpty(); verify(this.securityContextRepository, never()).save(any(), any()); - verifyZeroInteractions(this.successHandler, this.failureHandler); + verifyNoMoreInteractions(this.successHandler, this.failureHandler); } @Test @@ -208,7 +208,7 @@ public void filterWhenNotMatchAndConvertAndAuthenticationSuccessThenContinues() .expectBody(String.class).consumeWith((b) -> assertThat(b.getResponseBody()).isEqualTo("ok")) .returnResult(); assertThat(result.getResponseCookies()).isEmpty(); - verifyZeroInteractions(this.authenticationConverter, this.authenticationManager, this.successHandler); + verifyNoMoreInteractions(this.authenticationConverter, this.authenticationManager, this.successHandler); } @Test @@ -222,7 +222,7 @@ public void filterWhenConvertAndAuthenticationFailThenEntryPoint() { client.get().uri("/").exchange().expectStatus().isOk().expectBody().isEmpty(); verify(this.failureHandler).onAuthenticationFailure(any(), any()); verify(this.securityContextRepository, never()).save(any(), any()); - verifyZeroInteractions(this.successHandler); + verifyNoMoreInteractions(this.successHandler); } @Test @@ -233,7 +233,7 @@ public void filterWhenConvertAndAuthenticationExceptionThenServerError() { WebTestClient client = WebTestClientBuilder.bindToWebFilters(this.filter).build(); client.get().uri("/").exchange().expectStatus().is5xxServerError().expectBody().isEmpty(); verify(this.securityContextRepository, never()).save(any(), any()); - verifyZeroInteractions(this.successHandler, this.failureHandler); + verifyNoMoreInteractions(this.successHandler, this.failureHandler); } @Test diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPointTests.java index 872e403b48e..f2235043537 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPointTests.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -49,7 +49,7 @@ public class HttpBasicServerAuthenticationEntryPointTests { @Test public void commenceWhenNoSubscribersThenNoActions() { this.entryPoint.commence(this.exchange, this.exception); - verifyZeroInteractions(this.exchange); + verifyNoMoreInteractions(this.exchange); } @Test diff --git a/web/src/test/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManagerTests.java b/web/src/test/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManagerTests.java index c14c391ab99..f7ef26d8bfd 100644 --- a/web/src/test/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManagerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManagerTests.java @@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -81,7 +81,7 @@ public void checkWhenFirstMatchesThenNoMoreMatchersAndNoMoreDelegatesInvoked() { given(this.delegate1.check(eq(this.authentication), any(AuthorizationContext.class))) .willReturn(Mono.just(this.decision)); assertThat(this.manager.check(this.authentication, this.exchange).block()).isEqualTo(this.decision); - verifyZeroInteractions(this.match2, this.delegate2); + verifyNoMoreInteractions(this.match2, this.delegate2); } @Test @@ -91,7 +91,7 @@ public void checkWhenSecondMatchesThenNoMoreMatchersAndNoMoreDelegatesInvoked() given(this.delegate2.check(eq(this.authentication), any(AuthorizationContext.class))) .willReturn(Mono.just(this.decision)); assertThat(this.manager.check(this.authentication, this.exchange).block()).isEqualTo(this.decision); - verifyZeroInteractions(this.delegate1); + verifyNoMoreInteractions(this.delegate1); } } diff --git a/web/src/test/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandlerTests.java index a539cc64bf4..4a59d381b72 100644 --- a/web/src/test/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandlerTests.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -55,7 +55,7 @@ public void constructorHttpStatusWhenNullThenException() { @Test public void commenceWhenNoSubscribersThenNoActions() { this.handler.handle(this.exchange, this.exception); - verifyZeroInteractions(this.exchange); + verifyNoMoreInteractions(this.exchange); } @Test diff --git a/web/src/test/java/org/springframework/security/web/server/csrf/CsrfWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/csrf/CsrfWebFilterTests.java index aada7a4b629..ba20eaff1c8 100644 --- a/web/src/test/java/org/springframework/security/web/server/csrf/CsrfWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/csrf/CsrfWebFilterTests.java @@ -41,7 +41,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -164,7 +164,7 @@ public void doFilterWhenSkipExchangeInvokedThenSkips() { MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.post("/post").build()); CsrfWebFilter.skipExchange(exchange); this.csrfFilter.filter(exchange, this.chain).block(); - verifyZeroInteractions(matcher); + verifyNoMoreInteractions(matcher); } @Test diff --git a/web/src/test/java/org/springframework/security/web/server/util/matcher/PathMatcherServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/PathMatcherServerWebExchangeMatcherTests.java index 87a4369d792..1f33fe4b678 100644 --- a/web/src/test/java/org/springframework/security/web/server/util/matcher/PathMatcherServerWebExchangeMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/server/util/matcher/PathMatcherServerWebExchangeMatcherTests.java @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -108,7 +108,7 @@ public void matchesWhenPathMatcherTrueAndMethodFalseThenReturnFalse() { assertThat(this.exchange.getRequest().getMethod()).isNotEqualTo(method); this.matcher = new PathPatternParserServerWebExchangeMatcher(this.pattern, method); assertThat(this.matcher.matches(this.exchange).block().isMatch()).isFalse(); - verifyZeroInteractions(this.pattern); + verifyNoMoreInteractions(this.pattern); } } diff --git a/web/src/test/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchersTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchersTests.java index e37a4052ade..38631ae9c45 100644 --- a/web/src/test/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchersTests.java +++ b/web/src/test/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchersTests.java @@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -69,7 +69,7 @@ public void pathMatchersWhenMultiThenMatches() { public void anyExchangeWhenMockThenMatches() { ServerWebExchange mockExchange = mock(ServerWebExchange.class); assertThat(ServerWebExchangeMatchers.anyExchange().matches(mockExchange).block().isMatch()).isTrue(); - verifyZeroInteractions(mockExchange); + verifyNoMoreInteractions(mockExchange); } /** diff --git a/web/src/test/java/org/springframework/security/web/servlet/util/matcher/MvcRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/servlet/util/matcher/MvcRequestMatcherTests.java index 414f343a2e2..759cabd1a8b 100644 --- a/web/src/test/java/org/springframework/security/web/servlet/util/matcher/MvcRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/servlet/util/matcher/MvcRequestMatcherTests.java @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Rob Winch @@ -161,7 +161,7 @@ public void matchesMethodAndPathFalseMethod() { this.matcher.setMethod(HttpMethod.POST); assertThat(this.matcher.matches(this.request)).isFalse(); // method compare should be done first since faster - verifyZeroInteractions(this.introspector); + verifyNoMoreInteractions(this.introspector); } /** @@ -175,7 +175,7 @@ public void matchesInvalidMethodOnRequest() { this.request.setMethod("invalid"); assertThat(this.matcher.matches(this.request)).isFalse(); // method compare should be done first since faster - verifyZeroInteractions(this.introspector); + verifyNoMoreInteractions(this.introspector); } @Test diff --git a/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java b/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java index cf72a936317..3b909381a56 100644 --- a/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java @@ -60,7 +60,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * Tests {@link SecurityContextHolderAwareRequestFilter}. @@ -128,7 +128,7 @@ public void authenticateFalse() throws Exception { assertThat(wrappedRequest().authenticate(this.response)).isFalse(); verify(this.authenticationEntryPoint).commence(eq(this.requestCaptor.getValue()), eq(this.response), any(AuthenticationException.class)); - verifyZeroInteractions(this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationManager, this.logoutHandler); verify(this.request, times(0)).authenticate(any(HttpServletResponse.class)); } @@ -137,7 +137,7 @@ public void authenticateTrue() throws Exception { SecurityContextHolder.getContext() .setAuthentication(new TestingAuthenticationToken("test", "password", "ROLE_USER")); assertThat(wrappedRequest().authenticate(this.response)).isTrue(); - verifyZeroInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); verify(this.request, times(0)).authenticate(any(HttpServletResponse.class)); } @@ -147,7 +147,7 @@ public void authenticateNullEntryPointFalse() throws Exception { this.filter.afterPropertiesSet(); assertThat(wrappedRequest().authenticate(this.response)).isFalse(); verify(this.request).authenticate(this.response); - verifyZeroInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); } @Test @@ -157,7 +157,7 @@ public void authenticateNullEntryPointTrue() throws Exception { this.filter.afterPropertiesSet(); assertThat(wrappedRequest().authenticate(this.response)).isTrue(); verify(this.request).authenticate(this.response); - verifyZeroInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); } @Test @@ -167,7 +167,7 @@ public void login() throws Exception { .willReturn(expectedAuth); wrappedRequest().login(expectedAuth.getName(), String.valueOf(expectedAuth.getCredentials())); assertThat(SecurityContextHolder.getContext().getAuthentication()).isSameAs(expectedAuth); - verifyZeroInteractions(this.authenticationEntryPoint, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.logoutHandler); verify(this.request, times(0)).login(anyString(), anyString()); } @@ -179,7 +179,7 @@ public void loginWithExistingUser() throws Exception { assertThatExceptionOfType(ServletException.class).isThrownBy( () -> wrappedRequest().login(expectedAuth.getName(), String.valueOf(expectedAuth.getCredentials()))); assertThat(SecurityContextHolder.getContext().getAuthentication()).isSameAs(expectedAuth); - verifyZeroInteractions(this.authenticationEntryPoint, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.logoutHandler); verify(this.request, times(0)).login(anyString(), anyString()); } @@ -191,7 +191,7 @@ public void loginFail() throws Exception { assertThatExceptionOfType(ServletException.class) .isThrownBy(() -> wrappedRequest().login("invalid", "credentials")).withCause(authException); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); - verifyZeroInteractions(this.authenticationEntryPoint, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.logoutHandler); verify(this.request, times(0)).login(anyString(), anyString()); } @@ -203,7 +203,7 @@ public void loginNullAuthenticationManager() throws Exception { String password = "password"; wrappedRequest().login(username, password); verify(this.request).login(username, password); - verifyZeroInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); } @Test @@ -216,7 +216,7 @@ public void loginNullAuthenticationManagerFail() throws Exception { willThrow(authException).given(this.request).login(username, password); assertThatExceptionOfType(ServletException.class).isThrownBy(() -> wrappedRequest().login(username, password)) .isEqualTo(authException); - verifyZeroInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); } @Test @@ -247,7 +247,7 @@ public void logout() throws Exception { HttpServletRequest wrappedRequest = wrappedRequest(); wrappedRequest.logout(); verify(this.logoutHandler).logout(wrappedRequest, this.response, expectedAuth); - verifyZeroInteractions(this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationManager, this.logoutHandler); verify(this.request, times(0)).logout(); } @@ -257,7 +257,7 @@ public void logoutNullLogoutHandler() throws Exception { this.filter.afterPropertiesSet(); wrappedRequest().logout(); verify(this.request).logout(); - verifyZeroInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationEntryPoint, this.authenticationManager, this.logoutHandler); } // gh-3780 @@ -278,7 +278,7 @@ public void getAsyncContextStart() throws Exception { Runnable runnable = () -> { }; wrappedRequest().getAsyncContext().start(runnable); - verifyZeroInteractions(this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationManager, this.logoutHandler); verify(asyncContext).start(runnableCaptor.capture()); DelegatingSecurityContextRunnable wrappedRunnable = (DelegatingSecurityContextRunnable) runnableCaptor .getValue(); @@ -298,7 +298,7 @@ public void startAsyncStart() throws Exception { Runnable runnable = () -> { }; wrappedRequest().startAsync().start(runnable); - verifyZeroInteractions(this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationManager, this.logoutHandler); verify(asyncContext).start(runnableCaptor.capture()); DelegatingSecurityContextRunnable wrappedRunnable = (DelegatingSecurityContextRunnable) runnableCaptor .getValue(); @@ -318,7 +318,7 @@ public void startAsyncWithRequestResponseStart() throws Exception { Runnable runnable = () -> { }; wrappedRequest().startAsync(this.request, this.response).start(runnable); - verifyZeroInteractions(this.authenticationManager, this.logoutHandler); + verifyNoMoreInteractions(this.authenticationManager, this.logoutHandler); verify(asyncContext).start(runnableCaptor.capture()); DelegatingSecurityContextRunnable wrappedRunnable = (DelegatingSecurityContextRunnable) runnableCaptor .getValue(); diff --git a/web/src/test/java/org/springframework/security/web/session/SessionManagementFilterTests.java b/web/src/test/java/org/springframework/security/web/session/SessionManagementFilterTests.java index 670381901c5..a3b66b9ba13 100644 --- a/web/src/test/java/org/springframework/security/web/session/SessionManagementFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/session/SessionManagementFilterTests.java @@ -42,7 +42,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; /** * @author Luke Taylor @@ -75,7 +74,7 @@ public void strategyIsNotInvokedIfSecurityContextAlreadyExistsForRequest() throw HttpServletRequest request = new MockHttpServletRequest(); authenticateUser(); filter.doFilter(request, new MockHttpServletResponse(), new MockFilterChain()); - verifyZeroInteractions(strategy); + verifyNoMoreInteractions(strategy); } @Test @@ -85,7 +84,7 @@ public void strategyIsNotInvokedIfAuthenticationIsNull() throws Exception { SessionManagementFilter filter = new SessionManagementFilter(repo, strategy); HttpServletRequest request = new MockHttpServletRequest(); filter.doFilter(request, new MockHttpServletResponse(), new MockFilterChain()); - verifyZeroInteractions(strategy); + verifyNoMoreInteractions(strategy); } @Test @@ -120,7 +119,7 @@ public void strategyFailureInvokesFailureHandler() throws Exception { willThrow(exception).given(strategy).onAuthentication(SecurityContextHolder.getContext().getAuthentication(), request, response); filter.doFilter(request, response, fc); - verifyZeroInteractions(fc); + verifyNoMoreInteractions(fc); verify(failureHandler).onAuthenticationFailure(request, response, exception); } @@ -145,7 +144,7 @@ public void responseIsRedirectedToTimeoutUrlIfSetAndSessionIsInvalid() throws Ex filter.setInvalidSessionStrategy(iss); FilterChain fc = mock(FilterChain.class); filter.doFilter(request, response, fc); - verifyZeroInteractions(fc); + verifyNoMoreInteractions(fc); assertThat(response.getRedirectedUrl()).isEqualTo("/timedOut"); } @@ -171,7 +170,7 @@ public void responseIsRedirectedToRequestedUrlIfSetAndSessionIsInvalid() throws filter.setInvalidSessionStrategy(iss); FilterChain fc = mock(FilterChain.class); filter.doFilter(request, response, fc); - verifyZeroInteractions(fc); + verifyNoMoreInteractions(fc); assertThat(response.getRedirectedUrl()).isEqualTo("/requested"); }