From 3e93b024d6f7b3db7f671a8d95e92620cd008155 Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Thu, 8 Jul 2021 14:52:28 -0500 Subject: [PATCH] openrewrite Junit Migration --- .../acls/AclFormattingUtilsTests.java | 2 +- .../AclPermissionCacheOptimizerTests.java | 2 +- .../acls/AclPermissionEvaluatorTests.java | 2 +- ...ationCollectionFilteringProviderTests.java | 2 +- .../AclEntryAfterInvocationProviderTests.java | 2 +- .../domain/AccessControlImplEntryTests.java | 2 +- .../AclAuthorizationStrategyImplTests.java | 16 +-- .../security/acls/domain/AclImplTests.java | 10 +- .../AclImplementationSecurityCheckTests.java | 10 +- .../acls/domain/AuditLoggerTests.java | 10 +- .../acls/domain/ObjectIdentityImplTests.java | 2 +- ...ectIdentityRetrievalStrategyImplTests.java | 2 +- .../security/acls/domain/PermissionTests.java | 6 +- .../AbstractBasicLookupStrategyTests.java | 20 ++-- .../acls/jdbc/AclClassIdUtilsTests.java | 12 +- .../acls/jdbc/BasicLookupStrategyTests.java | 8 +- ...icLookupStrategyWithAclClassTypeTests.java | 16 +-- .../acls/jdbc/EhCacheBasedAclCacheTests.java | 16 +-- .../acls/jdbc/JdbcAclServiceTests.java | 18 +-- .../acls/jdbc/JdbcMutableAclServiceTests.java | 2 +- ...cMutableAclServiceTestsWithAclClassId.java | 2 +- .../jdbc/SpringCacheBasedAclCacheTests.java | 10 +- .../acls/sid/SidRetrievalStrategyTests.java | 2 +- .../security/acls/sid/SidTests.java | 2 +- .../aspect/AnnotationSecurityAspectTests.java | 10 +- .../CasAuthenticationProviderTests.java | 2 +- .../CasAuthenticationTokenTests.java | 2 +- .../EhCacheBasedTicketCacheTests.java | 10 +- .../NullStatelessTicketCacheTests.java | 2 +- .../SpringCacheBasedTicketCacheTests.java | 6 +- .../CasAuthenticationTokenMixinTests.java | 6 +- ...tionAttributesUserDetailsServiceTests.java | 2 +- .../web/CasAuthenticationEntryPointTests.java | 2 +- .../cas/web/CasAuthenticationFilterTests.java | 6 +- .../cas/web/ServicePropertiesTests.java | 2 +- ...aultServiceAuthenticationDetailsTests.java | 10 +- ...onProviderBuilderSecurityBuilderTests.java | 2 +- ...AuthenticationProviderConfigurerTests.java | 2 +- ...espaceLdapAuthenticationProviderTests.java | 2 +- .../rsocket/HelloRSocketITests.java | 16 +-- .../config/annotation/rsocket/JwtITests.java | 16 +-- ...RSocketMessageHandlerConnectionITests.java | 16 +-- .../rsocket/RSocketMessageHandlerITests.java | 16 +-- .../rsocket/SimpleAuthenticationITests.java | 16 +-- ...LdapProviderBeanDefinitionParserTests.java | 6 +- .../LdapServerBeanDefinitionParserTests.java | 6 +- ...pUserServiceBeanDefinitionParserTests.java | 6 +- .../config/FilterChainProxyConfigTests.java | 10 +- .../config/InvalidConfigurationTests.java | 6 +- .../config/SecurityNamespaceHandlerTests.java | 8 +- .../annotation/ObjectPostProcessorTests.java | 2 +- ...SecurityConfigurerAdapterClosureTests.java | 2 +- .../SecurityConfigurerAdapterTests.java | 6 +- .../AuthenticationManagerBuilderTests.java | 2 +- .../NamespaceAuthenticationManagerTests.java | 2 +- .../NamespaceAuthenticationProviderTests.java | 2 +- .../NamespaceJdbcUserServiceTests.java | 2 +- .../NamespacePasswordEncoderTests.java | 2 +- .../PasswordEncoderConfigurerTests.java | 2 +- ...thenticationConfigurationPublishTests.java | 8 +- .../AuthenticationConfigurationTests.java | 6 +- .../EnableGlobalAuthenticationTests.java | 2 +- ...AuthenticationProviderConfigurerTests.java | 6 +- .../UserDetailsManagerConfigurerTests.java | 6 +- ...reBeanFactoryObjectPostProcessorTests.java | 2 +- .../annotation/issue50/Issue50Tests.java | 16 +-- .../EnableReactiveMethodSecurityTests.java | 12 +- ...lobalMethodSecurityConfigurationTests.java | 8 +- ...lMethodSecurityExpressionHandlerTests.java | 8 +- .../NamespaceGlobalMethodSecurityTests.java | 8 +- ...ePostMethodSecurityConfigurationTests.java | 8 +- ...ctiveMethodSecurityConfigurationTests.java | 2 +- ...SampleEnableGlobalMethodSecurityTests.java | 6 +- .../annotation/sec2758/Sec2758Tests.java | 8 +- ...bstractConfiguredSecurityBuilderTests.java | 6 +- ...RequestMatcherRegistryAnyMatcherTests.java | 2 +- .../AbstractRequestMatcherRegistryTests.java | 6 +- .../web/HttpSecurityHeadersTests.java | 12 +- ...mpleWebSecurityConfigurerAdapterTests.java | 6 +- ...SecurityConfigurerAdapterMockitoTests.java | 12 +- .../WebSecurityConfigurerAdapterTests.java | 2 +- .../FilterOrderRegistrationTests.java | 2 +- .../web/builders/HttpConfigurationTests.java | 2 +- .../builders/HttpSecurityAddFilterTest.java | 2 +- ...ttpSecurityAuthenticationManagerTests.java | 2 +- .../web/builders/NamespaceHttpTests.java | 2 +- .../web/builders/WebSecurityTests.java | 10 +- ...icationPrincipalArgumentResolverTests.java | 12 +- .../configuration/EnableWebSecurityTests.java | 2 +- .../HttpSecurityConfigurationTests.java | 2 +- .../OAuth2ClientConfigurationTests.java | 2 +- .../web/configuration/Sec2515Tests.java | 2 +- ...ntextConfigurationResourceServerTests.java | 2 +- ...urityReactorContextConfigurationTests.java | 10 +- .../WebMvcSecurityConfigurationTests.java | 16 +-- .../WebSecurityConfigurationTests.java | 2 +- .../configuration/sec2377/Sec2377Tests.java | 2 +- ...gAttributeRequestMatcherRegistryTests.java | 6 +- .../configurers/AnonymousConfigurerTests.java | 2 +- .../AuthorizeHttpRequestsConfigurerTests.java | 2 +- .../configurers/AuthorizeRequestsTests.java | 10 +- .../ChannelSecurityConfigurerTests.java | 2 +- .../web/configurers/CorsConfigurerTests.java | 2 +- ...onfigurerIgnoringRequestMatchersTests.java | 2 +- .../CsrfConfigurerNoWebMvcTests.java | 6 +- .../web/configurers/CsrfConfigurerTests.java | 2 +- .../web/configurers/DefaultFiltersTests.java | 2 +- .../DefaultLoginPageConfigurerTests.java | 2 +- ...ingConfigurerAccessDeniedHandlerTests.java | 8 +- .../ExceptionHandlingConfigurerTests.java | 2 +- ...essionUrlAuthorizationConfigurerTests.java | 2 +- .../configurers/FormLoginConfigurerTests.java | 2 +- .../HeadersConfigurerEagerHeadersTests.java | 2 +- .../configurers/HeadersConfigurerTests.java | 2 +- .../configurers/HttpBasicConfigurerTests.java | 2 +- .../HttpSecurityAntMatchersTests.java | 10 +- .../configurers/HttpSecurityLogoutTests.java | 10 +- .../HttpSecurityRequestMatchersTests.java | 10 +- .../web/configurers/Issue55Tests.java | 2 +- .../web/configurers/JeeConfigurerTests.java | 2 +- .../LogoutConfigurerClearSiteDataTests.java | 8 +- .../configurers/LogoutConfigurerTests.java | 2 +- .../web/configurers/NamespaceDebugTests.java | 2 +- .../NamespaceHttpAnonymousTests.java | 2 +- .../configurers/NamespaceHttpBasicTests.java | 2 +- .../NamespaceHttpCustomFilterTests.java | 2 +- .../NamespaceHttpExpressionHandlerTests.java | 8 +- .../NamespaceHttpFirewallTests.java | 2 +- .../NamespaceHttpFormLoginTests.java | 2 +- .../NamespaceHttpHeadersTests.java | 2 +- .../NamespaceHttpInterceptUrlTests.java | 21 ++-- .../configurers/NamespaceHttpJeeTests.java | 2 +- .../configurers/NamespaceHttpLogoutTests.java | 8 +- .../NamespaceHttpOpenIDLoginTests.java | 2 +- .../NamespaceHttpPortMappingsTests.java | 2 +- .../NamespaceHttpRequestCacheTests.java | 2 +- ...aceHttpServerAccessDeniedHandlerTests.java | 2 +- .../configurers/NamespaceHttpX509Tests.java | 2 +- .../configurers/NamespaceRememberMeTests.java | 2 +- .../NamespaceSessionManagementTests.java | 2 +- .../PasswordManagementConfigurerTests.java | 2 +- .../configurers/PermitAllSupportTests.java | 2 +- .../PortMapperConfigurerTests.java | 2 +- .../RememberMeConfigurerTests.java | 2 +- .../RequestCacheConfigurerTests.java | 2 +- .../RequestMatcherConfigurerTests.java | 2 +- .../SecurityContextConfigurerTests.java | 2 +- .../ServletApiConfigurerTests.java | 2 +- ...ionManagementConfigurerServlet31Tests.java | 10 +- ...rerSessionAuthenticationStrategyTests.java | 2 +- ...tConfigurerSessionCreationPolicyTests.java | 2 +- .../SessionManagementConfigurerTests.java | 2 +- ...onfigurerTransientAuthenticationTests.java | 2 +- .../UrlAuthorizationConfigurerTests.java | 10 +- .../configurers/UrlAuthorizationsTests.java | 8 +- .../web/configurers/X509ConfigurerTests.java | 2 +- .../client/OAuth2ClientConfigurerTests.java | 6 +- .../client/OAuth2LoginConfigurerTests.java | 10 +- .../OAuth2ResourceServerConfigurerTests.java | 2 +- .../openid/OpenIDLoginConfigurerTests.java | 2 +- .../saml2/Saml2LoginConfigurerTests.java | 14 +-- ...geSecurityMetadataSourceRegistryTests.java | 12 +- .../reactive/EnableWebFluxSecurityTests.java | 8 +- .../ServerHttpSecurityConfigurationTests.java | 2 +- .../WebFluxSecurityConfigurationTests.java | 2 +- ...SocketMessageBrokerConfigurerDocTests.java | 10 +- ...WebSocketMessageBrokerConfigurerTests.java | 10 +- ...uthenticationConfigurationGh3935Tests.java | 8 +- ...ationManagerBeanDefinitionParserTests.java | 2 +- ...tionProviderBeanDefinitionParserTests.java | 6 +- ...cUserServiceBeanDefinitionParserTests.java | 6 +- .../PasswordEncoderParserTests.java | 2 +- .../UserServiceBeanDefinitionParserTests.java | 6 +- .../core/GrantedAuthorityDefaultsJcTests.java | 16 +-- .../GrantedAuthorityDefaultsXmlTests.java | 16 +-- ...ceFactoryBeanPropertiesResourceITests.java | 8 +- ...yBeanPropertiesResourceLocationITests.java | 8 +- ...erviceResourceFactoryBeanStringITests.java | 8 +- .../UserDetailsResourceFactoryBeanTests.java | 8 +- ...eyConversionServicePostProcessorTests.java | 6 +- ...ityDebugBeanFactoryPostProcessorTests.java | 2 +- .../config/doc/XsdDocumentedTests.java | 6 +- .../config/http/AccessDeniedConfigTests.java | 8 +- .../http/CsrfBeanDefinitionParserTests.java | 2 +- .../security/config/http/CsrfConfigTests.java | 8 +- .../DefaultFilterChainValidatorTests.java | 12 +- ...tadataSourceBeanDefinitionParserTests.java | 6 +- .../FormLoginBeanDefinitionParserTests.java | 2 +- .../config/http/FormLoginConfigTests.java | 2 +- .../security/config/http/HttpConfigTests.java | 2 +- .../config/http/HttpCorsConfigTests.java | 2 +- .../config/http/HttpHeadersConfigTests.java | 2 +- .../config/http/HttpInterceptUrlTests.java | 6 +- .../config/http/InterceptUrlConfigTests.java | 2 +- .../config/http/MiscHttpConfigTests.java | 2 +- .../http/MultiHttpBlockConfigTests.java | 2 +- .../config/http/NamespaceHttpBasicTests.java | 10 +- ...OAuth2ClientBeanDefinitionParserTests.java | 8 +- .../OAuth2LoginBeanDefinitionParserTests.java | 8 +- ...sourceServerBeanDefinitionParserTests.java | 8 +- .../config/http/OpenIDConfigTests.java | 2 +- .../http/PlaceHolderAndELConfigTests.java | 8 +- .../config/http/RememberMeConfigTests.java | 2 +- ...yContextHolderAwareRequestConfigTests.java | 8 +- ...SessionManagementConfigServlet31Tests.java | 10 +- .../http/SessionManagementConfigTests.java | 2 +- ...entConfigTransientAuthenticationTests.java | 2 +- .../config/http/WebConfigUtilsTests.java | 8 +- ...angePasswordBeanDefinitionParserTests.java | 2 +- .../CustomHttpSecurityConfigurerTests.java | 10 +- ...thodSecurityBeanDefinitionParserTests.java | 6 +- ...ptMethodsBeanDefinitionDecoratorTests.java | 16 +-- ...tationDrivenBeanDefinitionParserTests.java | 10 +- ...thodSecurityBeanDefinitionParserTests.java | 8 +- .../config/method/PreAuthorizeTests.java | 12 +- .../security/config/method/Sec2196Tests.java | 6 +- ...tationDrivenBeanDefinitionParserTests.java | 10 +- .../security/config/method/SecuredTests.java | 12 +- ...lobalMethodSecurityConfigurationTests.java | 8 +- .../config/method/sec2136/Sec2136Tests.java | 8 +- .../config/method/sec2499/Sec2499Tests.java | 6 +- ...egistrationsBeanDefinitionParserTests.java | 6 +- .../client/CommonOAuth2ProviderTests.java | 2 +- ...ceFactoryBeanPropertiesResourceITests.java | 8 +- ...yBeanPropertiesResourceLocationITests.java | 8 +- ...anagerResourceFactoryBeanStringITests.java | 8 +- .../server/AuthorizeExchangeSpecTests.java | 2 +- .../config/web/server/CorsSpecTests.java | 12 +- .../server/ExceptionHandlingSpecTests.java | 2 +- .../config/web/server/FormLoginTests.java | 2 +- .../config/web/server/HeaderSpecTests.java | 6 +- .../web/server/HttpsRedirectSpecTests.java | 2 +- .../config/web/server/LogoutSpecTests.java | 2 +- .../web/server/OAuth2ClientSpecTests.java | 8 +- .../config/web/server/OAuth2LoginTests.java | 2 +- .../server/OAuth2ResourceServerSpecTests.java | 8 +- .../server/PasswordManagementSpecTests.java | 2 +- .../config/web/server/RequestCacheTests.java | 2 +- .../web/server/ServerHttpSecurityTests.java | 12 +- .../MessageSecurityPostProcessorTests.java | 2 +- .../WebSocketMessageBrokerConfigTests.java | 8 +- ...bTestClientHtmlUnitDriverBuilderTests.java | 2 +- ...SecurityInterceptorWithAopConfigTests.java | 10 +- ...ticationCredentialsNotFoundEventTests.java | 2 +- .../AuthorizationFailureEventTests.java | 2 +- .../security/access/AuthorizedEventTests.java | 2 +- .../security/access/SecurityConfigTests.java | 2 +- ...r250MethodSecurityMetadataSourceTests.java | 6 +- .../access/annotation/Jsr250VoterTests.java | 2 +- ...AnnotationSecurityMetadataSourceTests.java | 2 +- ...bstractSecurityExpressionHandlerTests.java | 6 +- .../SecurityExpressionRootTests.java | 6 +- ...tMethodSecurityExpressionHandlerTests.java | 16 +-- ...pressionBasedPreInvocationAdviceTests.java | 12 +- .../method/MethodExpressionVoterTests.java | 2 +- .../MethodSecurityEvaluationContextTests.java | 8 +- .../MethodSecurityExpressionRootTests.java | 6 +- ...AnnotationSecurityMetadataSourceTests.java | 6 +- .../RoleHierarchyAuthoritiesMapperTests.java | 2 +- .../RoleHierarchyImplTests.java | 2 +- .../RoleHierarchyUtilsTests.java | 2 +- .../hierarchicalroles/TestHelperTests.java | 2 +- .../AbstractSecurityInterceptorTests.java | 2 +- .../AfterInvocationProviderManagerTests.java | 2 +- .../InterceptorStatusTokenTests.java | 2 +- .../intercept/NullRunAsManagerTests.java | 2 +- .../RunAsImplAuthenticationProviderTests.java | 6 +- .../intercept/RunAsManagerImplTests.java | 2 +- .../access/intercept/RunAsUserTokenTests.java | 2 +- .../MethodSecurityInterceptorTests.java | 10 +- ...hodSecurityMetadataSourceAdvisorTests.java | 2 +- ...AspectJMethodSecurityInterceptorTests.java | 10 +- ...asedMethodSecurityMetadataSourceTests.java | 6 +- ...thodInvocationPrivilegeEvaluatorTests.java | 6 +- ...tingMethodSecurityMetadataSourceTests.java | 2 +- ...vocationAuthorizationAdviceVoterTests.java | 12 +- .../AbstractAccessDecisionManagerTests.java | 2 +- .../access/vote/AbstractAclVoterTests.java | 2 +- .../access/vote/AffirmativeBasedTests.java | 6 +- .../access/vote/AuthenticatedVoterTests.java | 2 +- .../access/vote/ConsensusBasedTests.java | 2 +- .../access/vote/RoleHierarchyVoterTests.java | 2 +- .../security/access/vote/RoleVoterTests.java | 2 +- .../access/vote/UnanimousBasedTests.java | 2 +- .../AbstractAuthenticationTokenTests.java | 6 +- .../AuthenticationTrustResolverImplTests.java | 2 +- ...aultAuthenticationEventPublisherTests.java | 2 +- ...ingReactiveAuthenticationManagerTests.java | 8 +- .../authentication/ProviderManagerTests.java | 2 +- ...tiveAuthenticationManagerAdapterTests.java | 12 +- ...ailsServiceAuthenticationManagerTests.java | 12 +- .../TestingAuthenticationProviderTests.java | 2 +- .../TestingAuthenticationTokenTests.java | 2 +- ...oryReactiveAuthenticationManagerTests.java | 12 +- ...rnamePasswordAuthenticationTokenTests.java | 2 +- .../AnonymousAuthenticationProviderTests.java | 2 +- .../AnonymousAuthenticationTokenTests.java | 2 +- .../dao/DaoAuthenticationProviderTests.java | 2 +- .../event/AuthenticationEventTests.java | 2 +- .../event/LoggerListenerTests.java | 2 +- ...efaultJaasAuthenticationProviderTests.java | 6 +- .../jaas/JaasAuthenticationProviderTests.java | 6 +- .../jaas/JaasGrantedAuthorityTests.java | 2 +- .../authentication/jaas/Sec760Tests.java | 2 +- .../jaas/SecurityContextLoginModuleTests.java | 10 +- .../memory/InMemoryConfigurationTests.java | 6 +- .../RemoteAuthenticationManagerImplTests.java | 2 +- .../RemoteAuthenticationProviderTests.java | 2 +- ...RememberMeAuthenticationProviderTests.java | 2 +- .../RememberMeAuthenticationTokenTests.java | 2 +- ...uthenticatedAuthorizationManagerTests.java | 2 +- ...atedReactiveAuthorizationManagerTests.java | 8 +- .../AuthorityAuthorizationManagerTests.java | 2 +- ...rityReactiveAuthorizationManagerTests.java | 8 +- .../AuthorizationManagerTests.java | 2 +- ...ionManagerAfterMethodInterceptorTests.java | 2 +- ...onManagerBeforeMethodInterceptorTests.java | 2 +- .../AuthorizationMethodPointcutsTests.java | 2 +- .../Jsr250AuthorizationManagerTests.java | 2 +- ...ostAuthorizeAuthorizationManagerTests.java | 2 +- ...erAuthorizationMethodInterceptorTests.java | 10 +- ...PreAuthorizeAuthorizationManagerTests.java | 2 +- ...erAuthorizationMethodInterceptorTests.java | 10 +- .../SecuredAuthorizationManagerTests.java | 2 +- ...ngSecurityContextExecutorServiceTests.java | 6 +- ...elegatingSecurityContextExecutorTests.java | 2 +- ...yContextScheduledExecutorServiceTests.java | 6 +- ...tDelegatingSecurityContextTestSupport.java | 14 +-- ...ngSecurityContextExecutorServiceTests.java | 4 +- ...elegatingSecurityContextExecutorTests.java | 4 +- ...yContextScheduledExecutorServiceTests.java | 4 +- ...elegatingSecurityContextCallableTests.java | 16 +-- ...elegatingSecurityContextRunnableTests.java | 16 +-- ...DelegatingSecurityContextSupportTests.java | 2 +- ...ngSecurityContextExecutorServiceTests.java | 4 +- ...elegatingSecurityContextExecutorTests.java | 4 +- ...yContextScheduledExecutorServiceTests.java | 4 +- .../DelegatingApplicationListenerTests.java | 12 +- .../converter/RsaKeyConvertersTests.java | 2 +- .../security/core/JavaVersionTests.java | 2 +- .../core/SpringSecurityCoreVersionTests.java | 16 +-- .../SpringSecurityMessageSourceTests.java | 2 +- .../core/authority/AuthorityUtilsTests.java | 2 +- .../SimpleGrantedAuthorityTests.java | 2 +- ...ributes2GrantedAuthoritiesMapperTests.java | 2 +- .../mapping/SimpleAuthoritiesMapperTests.java | 2 +- .../SimpleMappableRolesRetrieverTests.java | 2 +- ...leRoles2GrantedAuthoritiesMapperTests.java | 2 +- .../ReactiveSecurityContextHolderTests.java | 2 +- .../context/SecurityContextHolderTests.java | 6 +- .../context/SecurityContextImplTests.java | 2 +- ...nnotationParameterNameDiscovererTests.java | 6 +- ...tSecurityParameterNameDiscovererTests.java | 6 +- .../core/session/SessionInformationTests.java | 2 +- .../session/SessionRegistryImplTests.java | 6 +- .../core/token/DefaultTokenTests.java | 2 +- .../KeyBasedPersistenceTokenServiceTests.java | 2 +- .../token/SecureRandomFactoryBeanTests.java | 2 +- .../MapReactiveUserDetailsServiceTests.java | 2 +- .../UserDetailsByNameServiceWrapperTests.java | 2 +- .../security/core/userdetails/UserTests.java | 2 +- .../cache/EhCacheBasedUserCacheTests.java | 10 +- .../userdetails/cache/NullUserCacheTests.java | 2 +- .../cache/SpringCacheBasedUserCacheTests.java | 10 +- .../userdetails/jdbc/JdbcDaoImplTests.java | 2 +- .../memory/UserAttributeEditorTests.java | 2 +- .../security/jackson2/AbstractMixinTests.java | 4 +- ...nonymousAuthenticationTokenMixinTests.java | 2 +- .../BadCredentialsExceptionMixinTests.java | 2 +- ...memberMeAuthenticationTokenMixinTests.java | 2 +- .../jackson2/SecurityContextMixinTests.java | 2 +- .../SecurityJackson2ModulesTests.java | 6 +- .../SimpleGrantedAuthorityMixinTests.java | 2 +- .../jackson2/UserDeserializerTests.java | 2 +- ...PasswordAuthenticationTokenMixinTests.java | 2 +- .../InMemoryUserDetailsManagerTests.java | 2 +- .../JdbcUserDetailsManagerTests.java | 18 +-- ...ityContextSchedulingTaskExecutorTests.java | 2 +- ...ityContextSchedulingTaskExecutorTests.java | 4 +- ...tingSecurityContextTaskSchedulerTests.java | 10 +- ...ityContextSchedulingTaskExecutorTests.java | 4 +- ...SecurityContextAsyncTaskExecutorTests.java | 6 +- ...SecurityContextAsyncTaskExecutorTests.java | 4 +- ...atingSecurityContextTaskExecutorTests.java | 4 +- ...SecurityContextAsyncTaskExecutorTests.java | 4 +- ...atingSecurityContextTaskExecutorTests.java | 4 +- .../security/util/FieldUtilsTests.java | 2 +- .../security/util/InMemoryResourceTests.java | 2 +- .../util/MethodInvocationUtilsTests.java | 2 +- .../argon2/Argon2EncodingUtilsTests.java | 2 +- .../argon2/Argon2PasswordEncoderTests.java | 8 +- .../bcrypt/BCryptPasswordEncoderTests.java | 2 +- .../security/crypto/bcrypt/BCryptTests.java | 6 +- .../security/crypto/codec/Base64Tests.java | 2 +- .../security/crypto/codec/HexTests.java | 2 +- .../security/crypto/codec/Utf8Tests.java | 2 +- .../encrypt/AesBytesEncryptorTests.java | 6 +- ...stleAesBytesEncryptorEquivalencyTests.java | 18 +-- .../BouncyCastleAesBytesEncryptorTests.java | 14 +-- .../crypto/encrypt/CryptoAssumptions.java | 4 +- .../crypto/encrypt/EncryptorsTests.java | 2 +- .../PasswordEncoderFactoriesTests.java | 2 +- .../keygen/Base64StringKeyGeneratorTests.java | 2 +- .../crypto/keygen/KeyGeneratorsTests.java | 2 +- .../DelegatingPasswordEncoderTests.java | 12 +- .../crypto/password/DigesterTests.java | 2 +- .../password/LdapShaPasswordEncoderTests.java | 2 +- .../password/Md4PasswordEncoderTests.java | 2 +- .../MessageDigestPasswordEncoderTests.java | 2 +- .../password/PasswordEncoderUtilsTests.java | 2 +- .../password/Pbkdf2PasswordEncoderTests.java | 2 +- .../StandardPasswordEncoderTests.java | 2 +- .../scrypt/SCryptPasswordEncoderTests.java | 2 +- .../crypto/util/EncodingUtilsTests.java | 2 +- ...curityEvaluationContextExtensionTests.java | 10 +- ...amespaceWithMultipleInterceptorsTests.java | 8 +- .../HttpPathParameterStrippingTests.java | 8 +- .../integration/MultiAnnotationTests.java | 16 +-- .../SEC933ApplicationContextTests.java | 8 +- .../SEC936ApplicationContextTests.java | 8 +- .../PythonInterpreterBasedSecurityTests.java | 8 +- .../FilterChainPerformanceTests.java | 20 ++-- .../ProtectPointcutPerformanceTests.java | 12 +- .../LdapServerBeanDefinitionParserTests.java | 10 +- .../LdapServerBeanDefinitionParserTests.java | 10 +- .../LdapServerBeanDefinitionParserTests.java | 10 +- .../LdapServerBeanDefinitionParserTests.java | 6 +- .../LdapServerBeanDefinitionParserTests.java | 10 +- .../AbstractWebServerIntegrationTests.java | 4 +- .../integration/BasicAuthenticationTests.java | 2 +- .../ConcurrentSessionManagementTests.java | 2 +- ...faultSpringSecurityContextSourceTests.java | 8 +- .../SpringSecurityLdapTemplateITests.java | 12 +- .../BindAuthenticatorTests.java | 12 +- .../PasswordComparisonAuthenticatorTests.java | 12 +- .../FilterBasedLdapUserSearchTests.java | 8 +- ...terBasedLdapUserSearchWithSpacesTests.java | 8 +- .../ldap/server/ApacheDSContainerTests.java | 13 +-- .../server/ApacheDSEmbeddedLdifTests.java | 14 +-- .../server/UnboundIdContainerLdifTests.java | 6 +- .../ldap/server/UnboundIdContainerTests.java | 2 +- .../DefaultLdapAuthoritiesPopulatorTests.java | 12 +- ...UserDetailsManagerModifyPasswordTests.java | 12 +- .../LdapUserDetailsManagerTests.java | 16 +-- .../NestedLdapAuthoritiesPopulatorTests.java | 12 +- .../security/ldap/LdapUtilsTests.java | 2 +- ...ringSecurityAuthenticationSourceTests.java | 10 +- .../ldap/SpringSecurityLdapTemplateTests.java | 8 +- .../LdapAuthenticationProviderTests.java | 2 +- ...swordComparisonAuthenticatorMockTests.java | 2 +- ...ectoryLdapAuthenticationProviderTests.java | 6 +- ...PasswordPolicyAwareContextSourceTests.java | 6 +- .../PasswordPolicyControlFactoryTests.java | 2 +- .../PasswordPolicyResponseControlTests.java | 2 +- .../ldap/userdetails/InetOrgPersonTests.java | 2 +- .../ldap/userdetails/LdapAuthorityTests.java | 6 +- .../userdetails/LdapUserDetailsImplTests.java | 2 +- .../LdapUserDetailsMapperTests.java | 2 +- .../LdapUserDetailsServiceTests.java | 2 +- ...sServiceLdapAuthoritiesPopulatorTests.java | 2 +- ...MessageSecurityExpressionHandlerTests.java | 12 +- ...ageSecurityMetadataSourceFactoryTests.java | 12 +- ...MessageExpressionConfigAttributeTests.java | 12 +- .../MessageExpressionVoterTests.java | 12 +- .../ChannelSecurityInterceptorTests.java | 16 +-- ...ultMessageSecurityMetadataSourceTests.java | 12 +- ...icationPrincipalArgumentResolverTests.java | 10 +- ...ecurityContextChannelInterceptorTests.java | 16 +-- ...icationPrincipalArgumentResolverTests.java | 2 +- ...tSecurityContextArgumentResolverTests.java | 2 +- .../util/matcher/AndMessageMatcherTests.java | 8 +- .../util/matcher/OrMessageMatcherTests.java | 8 +- .../SimpDestinationMessageMatcherTests.java | 6 +- .../matcher/SimpMessageTypeMatcherTests.java | 6 +- .../web/csrf/CsrfChannelInterceptorTests.java | 12 +- .../CsrfTokenHandshakeInterceptorTests.java | 12 +- ...deOAuth2AuthorizedClientProviderTests.java | 6 +- ...veOAuth2AuthorizedClientProviderTests.java | 6 +- ...iceOAuth2AuthorizedClientManagerTests.java | 6 +- ...iveOAuth2AuthorizedClientManagerTests.java | 6 +- ...lsOAuth2AuthorizedClientProviderTests.java | 6 +- ...veOAuth2AuthorizedClientProviderTests.java | 6 +- ...ngOAuth2AuthorizedClientProviderTests.java | 2 +- ...veOAuth2AuthorizedClientProviderTests.java | 2 +- ...oryOAuth2AuthorizedClientServiceTests.java | 2 +- ...iveOAuth2AuthorizedClientServiceTests.java | 12 +- ...dbcOAuth2AuthorizedClientServiceTests.java | 10 +- ...erOAuth2AuthorizedClientProviderTests.java | 6 +- .../OAuth2AuthorizationContextTests.java | 6 +- .../client/OAuth2AuthorizeRequestTests.java | 2 +- .../client/OAuth2AuthorizedClientIdTests.java | 2 +- ...2AuthorizedClientProviderBuilderTests.java | 6 +- .../client/OAuth2AuthorizedClientTests.java | 6 +- ...rdOAuth2AuthorizedClientProviderTests.java | 6 +- ...veOAuth2AuthorizedClientProviderTests.java | 6 +- ...iveOAuth2AuthorizedClientServiceTests.java | 6 +- ...2AuthorizedClientProviderBuilderTests.java | 10 +- ...enOAuth2AuthorizedClientProviderTests.java | 6 +- ...veOAuth2AuthorizedClientProviderTests.java | 6 +- .../OAuth2AuthenticationTokenTests.java | 6 +- ...zationCodeAuthenticationProviderTests.java | 6 +- ...orizationCodeAuthenticationTokenTests.java | 6 +- ...odeReactiveAuthenticationManagerTests.java | 12 +- ...Auth2LoginAuthenticationProviderTests.java | 6 +- .../OAuth2LoginAuthenticationTokenTests.java | 6 +- ...ginReactiveAuthenticationManagerTests.java | 16 +-- ...orizationCodeTokenResponseClientTests.java | 10 +- ...ntCredentialsTokenResponseClientTests.java | 10 +- ...aultJwtBearerTokenResponseClientTests.java | 10 +- ...faultPasswordTokenResponseClientTests.java | 10 +- ...tRefreshTokenTokenResponseClientTests.java | 10 +- .../client/endpoint/JoseHeaderTests.java | 2 +- ...earerGrantRequestEntityConverterTests.java | 6 +- .../endpoint/JwtBearerGrantRequestTests.java | 2 +- .../client/endpoint/JwtClaimsSetTests.java | 2 +- ...orizationCodeTokenResponseClientTests.java | 6 +- .../endpoint/NimbusJwsEncoderTests.java | 6 +- ...uthenticationParametersConverterTests.java | 6 +- ...nCodeGrantRequestEntityConverterTests.java | 6 +- ...th2AuthorizationCodeGrantRequestTests.java | 6 +- ...tialsGrantRequestEntityConverterTests.java | 6 +- ...th2ClientCredentialsGrantRequestTests.java | 6 +- ...swordGrantRequestEntityConverterTests.java | 6 +- .../OAuth2PasswordGrantRequestTests.java | 2 +- ...TokenGrantRequestEntityConverterTests.java | 6 +- .../OAuth2RefreshTokenGrantRequestTests.java | 6 +- ...orizationCodeTokenResponseClientTests.java | 10 +- ...ntCredentialsTokenResponseClientTests.java | 10 +- ...ctivePasswordTokenResponseClientTests.java | 10 +- ...eRefreshTokenTokenResponseClientTests.java | 10 +- .../OAuth2ErrorResponseErrorHandlerTests.java | 2 +- ...uth2AuthenticationExceptionMixinTests.java | 6 +- .../OAuth2AuthenticationTokenMixinTests.java | 6 +- .../OAuth2AuthorizationRequestMixinTests.java | 6 +- .../OAuth2AuthorizedClientMixinTests.java | 6 +- ...zationCodeAuthenticationProviderTests.java | 6 +- ...odeReactiveAuthenticationManagerTests.java | 12 +- .../OidcIdTokenDecoderFactoryTests.java | 6 +- .../OidcIdTokenValidatorTests.java | 6 +- ...eactiveOidcIdTokenDecoderFactoryTests.java | 6 +- .../OidcReactiveOAuth2UserServiceTests.java | 12 +- .../oidc/userinfo/OidcUserRequestTests.java | 6 +- .../userinfo/OidcUserRequestUtilsTests.java | 2 +- .../oidc/userinfo/OidcUserServiceTests.java | 10 +- ...entInitiatedLogoutSuccessHandlerTests.java | 12 +- ...tiatedServerLogoutSuccessHandlerTests.java | 6 +- .../registration/ClientRegistrationTests.java | 2 +- .../ClientRegistrationsTests.java | 10 +- ...moryClientRegistrationRepositoryTests.java | 2 +- ...tiveClientRegistrationRepositoryTests.java | 6 +- ...CustomUserTypesOAuth2UserServiceTests.java | 10 +- .../DefaultOAuth2UserServiceTests.java | 10 +- ...DefaultReactiveOAuth2UserServiceTests.java | 10 +- .../DelegatingOAuth2UserServiceTests.java | 2 +- ...OAuth2UserRequestEntityConverterTests.java | 2 +- .../userinfo/OAuth2UserRequestTests.java | 6 +- ...OAuth2AuthorizedClientRepositoryTests.java | 6 +- ...uth2AuthorizationRequestResolverTests.java | 6 +- ...ultOAuth2AuthorizedClientManagerTests.java | 6 +- ...iveOAuth2AuthorizedClientManagerTests.java | 6 +- ...lowMultipleAuthorizationRequestsTests.java | 6 +- ...lowMultipleAuthorizationRequestsTests.java | 6 +- ...h2AuthorizationRequestRepositoryTests.java | 8 +- ...OAuth2AuthorizedClientRepositoryTests.java | 6 +- ...uth2AuthorizationCodeGrantFilterTests.java | 10 +- ...thorizationRequestRedirectFilterTests.java | 6 +- .../OAuth2LoginAuthenticationFilterTests.java | 6 +- ...AuthorizedClientArgumentResolverTests.java | 10 +- ...zedClientExchangeFilterFunctionITests.java | 10 +- ...izedClientExchangeFilterFunctionTests.java | 12 +- ...zedClientExchangeFilterFunctionITests.java | 14 +-- ...izedClientExchangeFilterFunctionTests.java | 16 +-- ...AuthorizedClientArgumentResolverTests.java | 12 +- ...OAuth2AuthorizedClientRepositoryTests.java | 6 +- ...uth2AuthorizationRequestResolverTests.java | 12 +- ...2AuthorizationCodeGrantWebFilterTests.java | 12 +- ...rizationRequestRedirectWebFilterTests.java | 12 +- ...CodeAuthenticationTokenConverterTests.java | 12 +- ...OAuth2AuthorizedClientRepositoryTests.java | 6 +- ...lowMultipleAuthorizationRequestsTests.java | 6 +- ...lowMultipleAuthorizationRequestsTests.java | 6 +- ...erAuthorizationRequestRepositoryTests.java | 2 +- ...OAuth2AuthorizedClientRepositoryTests.java | 2 +- ...uth2LoginAuthenticationWebFilterTests.java | 12 +- .../core/AuthenticationMethodTests.java | 2 +- .../core/AuthorizationGrantTypeTests.java | 2 +- .../oauth2/core/ClaimAccessorTests.java | 6 +- .../core/ClientAuthenticationMethodTests.java | 2 +- ...aultOAuth2AuthenticatedPrincipalTests.java | 2 +- .../DelegatingOAuth2TokenValidatorTests.java | 2 +- .../oauth2/core/OAuth2AccessTokenTests.java | 2 +- .../oauth2/core/OAuth2ErrorTests.java | 2 +- .../oauth2/core/OAuth2RefreshTokenTests.java | 2 +- .../core/OAuth2TokenValidatorResultTests.java | 2 +- .../ClaimConversionServiceTests.java | 2 +- .../converter/ClaimTypeConverterTests.java | 6 +- ...uth2AccessTokenResponseConverterTests.java | 108 +++++++++--------- ...2AccessTokenResponseMapConverterTests.java | 48 ++++---- .../OAuth2AccessTokenResponseTests.java | 2 +- .../OAuth2AuthorizationExchangeTests.java | 2 +- .../OAuth2AuthorizationRequestTests.java | 2 +- .../OAuth2AuthorizationResponseTests.java | 2 +- .../OAuth2AuthorizationResponseTypeTests.java | 2 +- ...okenResponseHttpMessageConverterTests.java | 6 +- .../OAuth2ErrorHttpMessageConverterTests.java | 6 +- .../DefaultAddressStandardClaimTests.java | 2 +- .../core/oidc/OidcIdTokenBuilderTests.java | 2 +- .../oauth2/core/oidc/OidcIdTokenTests.java | 2 +- .../core/oidc/OidcUserInfoBuilderTests.java | 2 +- .../oauth2/core/oidc/OidcUserInfoTests.java | 2 +- .../core/oidc/user/DefaultOidcUserTests.java | 2 +- .../oidc/user/OidcUserAuthorityTests.java | 2 +- .../core/user/DefaultOAuth2UserTests.java | 2 +- .../core/user/OAuth2UserAuthorityTests.java | 2 +- .../function/OAuth2BodyExtractorsTests.java | 6 +- .../oauth2/jose/jws/MacAlgorithmTests.java | 2 +- .../jose/jws/SignatureAlgorithmTests.java | 2 +- .../security/oauth2/jwt/JwtBuilderTests.java | 2 +- .../oauth2/jwt/JwtClaimValidatorTests.java | 2 +- ...ecoderProviderConfigurationUtilsTests.java | 2 +- .../security/oauth2/jwt/JwtDecodersTests.java | 10 +- .../oauth2/jwt/JwtIssuerValidatorTests.java | 2 +- .../security/oauth2/jwt/JwtTests.java | 2 +- .../jwt/JwtTimestampValidatorTests.java | 2 +- .../jwt/MappedJwtClaimSetConverterTests.java | 2 +- .../jwt/NimbusJwtDecoderJwkSupportTests.java | 2 +- .../oauth2/jwt/NimbusJwtDecoderTests.java | 6 +- .../jwt/NimbusReactiveJwtDecoderTests.java | 14 +-- .../oauth2/jwt/ReactiveJwtDecodersTests.java | 10 +- .../jwt/ReactiveRemoteJWKSourceTests.java | 12 +- .../BearerTokenAuthenticationTokenTests.java | 2 +- .../resource/BearerTokenErrorTests.java | 2 +- .../resource/BearerTokenErrorsTests.java | 2 +- ...icationEventPublisherBearerTokenTests.java | 2 +- .../BearerTokenAuthenticationTests.java | 6 +- ...ngJwtGrantedAuthoritiesConverterTests.java | 2 +- .../JwtAuthenticationConverterTests.java | 2 +- .../JwtAuthenticationProviderTests.java | 12 +- .../JwtAuthenticationTokenTests.java | 8 +- ...arerTokenAuthenticationConverterTests.java | 2 +- .../JwtGrantedAuthoritiesConverterTests.java | 2 +- ...uerAuthenticationManagerResolverTests.java | 2 +- ...iveAuthenticationManagerResolverTests.java | 2 +- ...JwtReactiveAuthenticationManagerTests.java | 12 +- ...paqueTokenAuthenticationProviderTests.java | 2 +- ...kenReactiveAuthenticationManagerTests.java | 2 +- ...wtAuthenticationConverterAdapterTests.java | 2 +- ...activeJwtAuthenticationConverterTests.java | 2 +- ...antedAuthoritiesConverterAdapterTests.java | 2 +- .../NimbusOpaqueTokenIntrospectorTests.java | 2 +- ...sReactiveOpaqueTokenIntrospectorTests.java | 2 +- ...rospectionAuthenticatedPrincipalTests.java | 2 +- ...rerTokenAuthenticationEntryPointTests.java | 6 +- .../BearerTokenAuthenticationFilterTests.java | 12 +- .../web/DefaultBearerTokenResolverTests.java | 6 +- .../web/HeaderBearerTokenResolverTests.java | 2 +- .../BearerTokenAccessDeniedHandlerTests.java | 6 +- ...erTokenServerAccessDeniedHandlerTests.java | 6 +- ...rverBearerExchangeFilterFunctionTests.java | 2 +- ...vletBearerExchangeFilterFunctionTests.java | 8 +- ...enServerAuthenticationEntryPointTests.java | 2 +- ...arerTokenAuthenticationConverterTests.java | 6 +- .../openid/OpenID4JavaConsumerTests.java | 2 +- .../OpenIDAuthenticationFilterTests.java | 6 +- .../OpenIDAuthenticationProviderTests.java | 2 +- .../remoting/dns/JndiDnsResolverTests.java | 6 +- ...SimpleHttpInvokerRequestExecutorTests.java | 6 +- ...ntextPropagatingRemoteInvocationTests.java | 6 +- .../AnonymousPayloadInterceptorTests.java | 12 +- ...AuthenticationPayloadInterceptorTests.java | 8 +- .../AuthorizationPayloadInterceptorTests.java | 8 +- ...cherReactiveAuthorizationManagerTests.java | 8 +- .../core/PayloadInterceptorRSocketTests.java | 8 +- ...PayloadSocketAcceptorInterceptorTests.java | 12 +- .../core/PayloadSocketAcceptorTests.java | 12 +- .../BasicAuthenticationDecoderTests.java | 2 +- .../RoutePayloadExchangeMatcherTests.java | 12 +- .../OpenSamlAuthenticationProviderTests.java | 2 +- ...SamlAuthenticationRequestFactoryTests.java | 12 +- .../OpenSaml4AuthenticationProviderTests.java | 2 +- ...aml4AuthenticationRequestFactoryTests.java | 10 +- .../OpenSamlInitializationServiceTests.java | 2 +- .../Saml2ResponseValidatorResultTests.java | 2 +- .../saml2/core/Saml2X509CredentialTests.java | 6 +- .../credentials/Saml2X509CredentialTests.java | 6 +- ...faultSaml2AuthenticatedPrincipalTests.java | 2 +- .../OpenSamlSigningUtilsTests.java | 6 +- ...aml2AuthenticationRequestFactoryTests.java | 2 +- .../OpenSamlMetadataResolverTests.java | 2 +- ...lAssertingPartyMetadataConverterTests.java | 6 +- ...ationBuilderHttpMessageConverterTests.java | 6 +- .../RelyingPartyRegistrationTests.java | 2 +- .../RelyingPartyRegistrationsTests.java | 6 +- .../Saml2WebSsoAuthenticationFilterTests.java | 12 +- ...ebSsoAuthenticationRequestFilterTests.java | 6 +- ...RelyingPartyRegistrationResolverTests.java | 2 +- ...enticationRequestContextResolverTests.java | 6 +- ...aml2AuthenticationTokenConverterTests.java | 8 +- .../service/web/Saml2MetadataFilterTests.java | 6 +- .../security/taglibs/TldTests.java | 2 +- .../authz/AbstractAuthorizeTagTests.java | 10 +- .../authz/AccessControlListTagTests.java | 10 +- .../taglibs/authz/AuthenticationTagTests.java | 6 +- .../taglibs/authz/AuthorizeTagTests.java | 16 +-- .../taglibs/csrf/AbstractCsrfTagTests.java | 6 +- .../taglibs/csrf/CsrfInputTagTests.java | 6 +- .../taglibs/csrf/CsrfMetaTagsTagTests.java | 6 +- .../TestSecurityContextHolderTests.java | 10 +- .../SecurityTestExecutionListenerTests.java | 8 +- .../showcase/WithMockUserParentTests.java | 8 +- .../context/showcase/WithMockUserTests.java | 8 +- .../showcase/WithUserDetailsTests.java | 8 +- ...ctorContextTestExecutionListenerTests.java | 12 +- .../support/WithAnonymousUserTests.java | 2 +- ...thMockUserSecurityContextFactoryTests.java | 12 +- .../context/support/WithMockUserTests.java | 2 +- ...ityContextTestExcecutionListenerTests.java | 16 +-- ...rityContextTestExecutionListenerTests.java | 12 +- ...serDetailsSecurityContextFactoryTests.java | 12 +- .../context/support/WithUserDetailsTests.java | 2 +- ...yMockServerConfigurerOpaqueTokenTests.java | 8 +- ...tyMockServerConfigurersAnnotatedTests.java | 8 +- ...kServerConfigurersClassAnnotatedTests.java | 8 +- ...SecurityMockServerConfigurersJwtTests.java | 8 +- ...ockServerConfigurersOAuth2ClientTests.java | 12 +- ...MockServerConfigurersOAuth2LoginTests.java | 12 +- ...tyMockServerConfigurersOidcLoginTests.java | 12 +- .../SecurityMockServerConfigurersTests.java | 2 +- .../web/servlet/request/Sec2935Tests.java | 16 +-- ...yMockMvcRequestBuildersFormLoginTests.java | 6 +- ...MockMvcRequestBuildersFormLogoutTests.java | 6 +- ...rocessorsAuthenticationStatelessTests.java | 12 +- ...uestPostProcessorsAuthenticationTests.java | 16 +-- ...RequestPostProcessorsCertificateTests.java | 12 +- ...estPostProcessorsCsrfDebugFilterTests.java | 8 +- ...MockMvcRequestPostProcessorsCsrfTests.java | 12 +- ...ckMvcRequestPostProcessorsDigestTests.java | 10 +- ...yMockMvcRequestPostProcessorsJwtTests.java | 16 +-- ...equestPostProcessorsOAuth2ClientTests.java | 16 +-- ...RequestPostProcessorsOAuth2LoginTests.java | 12 +- ...vcRequestPostProcessorsOidcLoginTests.java | 16 +-- ...RequestPostProcessorsOpaqueTokenTests.java | 12 +- ...estPostProcessorsSecurityContextTests.java | 16 +-- ...sorsTestSecurityContextStatelessTests.java | 12 +- ...ostProcessorsTestSecurityContextTests.java | 16 +-- ...RequestPostProcessorsUserDetailsTests.java | 16 +-- ...MockMvcRequestPostProcessorsUserTests.java | 16 +-- .../web/servlet/response/Gh3409Tests.java | 12 +- .../SecurityMockMvcResultMatchersTests.java | 12 +- ...WithAuthoritiesMvcResultMatchersTests.java | 12 +- .../setup/SecurityMockMvcConfigurerTests.java | 12 +- .../SecurityMockMvcConfigurersTests.java | 8 +- .../showcase/csrf/CsrfShowcaseTests.java | 12 +- .../csrf/CustomCsrfShowcaseTests.java | 12 +- .../csrf/DefaultCsrfShowcaseTests.java | 12 +- .../showcase/login/AuthenticationTests.java | 12 +- .../CustomConfigAuthenticationTests.java | 12 +- ...oginRequestBuilderAuthenticationTests.java | 12 +- .../DefaultfSecurityRequestsTests.java | 12 +- .../secured/SecurityRequestsTests.java | 12 +- .../secured/WithUserAuthenticationTests.java | 12 +- ...WithUserClassLevelAuthenticationTests.java | 12 +- .../WithUserDetailsAuthenticationTests.java | 12 +- ...rDetailsClassLevelAuthenticationTests.java | 12 +- .../test/web/support/WebTestUtilsTests.java | 16 +-- .../web/DefaultRedirectStrategyTests.java | 2 +- .../security/web/FilterChainProxyTests.java | 10 +- .../security/web/FilterInvocationTests.java | 2 +- .../security/web/PortMapperImplTests.java | 2 +- .../security/web/PortResolverImplTests.java | 2 +- .../RequestMatcherRedirectFilterTests.java | 2 +- ...tWebInvocationPrivilegeEvaluatorTests.java | 6 +- .../DelegatingAccessDeniedHandlerTests.java | 12 +- .../ExceptionTranslationFilterTests.java | 10 +- ...herDelegatingAccessDeniedHandlerTests.java | 6 +- .../ChannelDecisionManagerImplTests.java | 2 +- .../channel/ChannelProcessingFilterTests.java | 2 +- .../InsecureChannelProcessorTests.java | 2 +- .../channel/RetryWithHttpEntryPointTests.java | 2 +- .../RetryWithHttpsEntryPointTests.java | 2 +- .../channel/SecureChannelProcessorTests.java | 2 +- ...leEvaluationContextPostProcessorTests.java | 6 +- ...aultWebSecurityExpressionHandlerTests.java | 16 +-- .../DelegatingEvaluationContextTests.java | 8 +- ...InvocationSecurityMetadataSourceTests.java | 2 +- .../expression/WebExpressionVoterTests.java | 2 +- .../WebSecurityExpressionRootTests.java | 2 +- .../intercept/AuthorizationFilterTests.java | 6 +- ...InvocationSecurityMetadataSourceTests.java | 2 +- .../FilterSecurityInterceptorTests.java | 10 +- .../web/access/intercept/RequestKeyTests.java | 2 +- ...erDelegatingAuthorizationManagerTests.java | 2 +- ...ctAuthenticationProcessingFilterTests.java | 10 +- .../AnonymousAuthenticationFilterTests.java | 10 +- .../AuthenticationFilterTests.java | 16 +-- ...DefaultLoginPageGeneratingFilterTests.java | 2 +- ...gAuthenticationEntryPointContextTests.java | 8 +- ...legatingAuthenticationEntryPointTests.java | 6 +- ...tingAuthenticationFailureHandlerTests.java | 12 +- ...pingAuthenticationFailureHandlerTests.java | 2 +- ...rwardAuthenticaionSuccessHandlerTests.java | 2 +- ...wardAuthenticationFailureHandlerTests.java | 2 +- .../HttpStatusEntryPointTests.java | 6 +- ...LoginUrlAuthenticationEntryPointTests.java | 2 +- ...wareAuthenticationSuccessHandlerTests.java | 2 +- ...eUrlAuthenticationFailureHandlerTests.java | 2 +- ...eUrlAuthenticationSuccessHandlerTests.java | 2 +- ...namePasswordAuthenticationFilterTests.java | 2 +- .../logout/CompositeLogoutHandlerTests.java | 2 +- .../CookieClearingLogoutHandlerTests.java | 2 +- .../DelegatingLogoutSuccessHandlerTests.java | 12 +- .../ForwardLogoutSuccessHandlerTests.java | 2 +- .../HeaderWriterLogoutHandlerTests.java | 6 +- ...tusReturningLogoutSuccessHandlerTests.java | 2 +- .../logout/LogoutHandlerTests.java | 6 +- ...cessEventPublishingLogoutHandlerTests.java | 2 +- .../SecurityContextLogoutHandlerTests.java | 10 +- .../SimpleUrlLogoutSuccessHandlerTests.java | 2 +- ...PreAuthenticatedProcessingFilterTests.java | 10 +- ...henticatedAuthenticationProviderTests.java | 2 +- ...AuthenticatedAuthenticationTokenTests.java | 2 +- ...tedAuthoritiesUserDetailsServiceTests.java | 2 +- ...horitiesWebAuthenticationDetailsTests.java | 2 +- ...estAttributeAuthenticationFilterTests.java | 10 +- ...equestHeaderAuthenticationFilterTests.java | 10 +- ...edWebAuthenticationDetailsSourceTests.java | 2 +- ...PreAuthenticatedProcessingFilterTests.java | 2 +- .../WebXmlJ2eeDefinedRolesRetrieverTests.java | 2 +- ...PreAuthenticatedProcessingFilterTests.java | 6 +- .../SubjectDnX509PrincipalExtractorTests.java | 6 +- .../AbstractRememberMeServicesTests.java | 6 +- .../JdbcTokenRepositoryImplTests.java | 24 ++-- .../NullRememberMeServicesTests.java | 2 +- ...tentTokenBasedRememberMeServicesTests.java | 6 +- .../RememberMeAuthenticationFilterTests.java | 10 +- .../TokenBasedRememberMeServicesTests.java | 6 +- ...eSessionIdAuthenticationStrategyTests.java | 2 +- ...iteSessionAuthenticationStrategyTests.java | 8 +- ...ionControlAuthenticationStrategyTests.java | 12 +- ...terSessionAuthenticationStrategyTests.java | 12 +- .../switchuser/SwitchUserFilterTests.java | 10 +- .../SwitchUserGrantedAuthorityTests.java | 2 +- ...efaultLogoutPageGeneratingFilterTests.java | 2 +- .../BasicAuthenticationConverterTests.java | 12 +- .../BasicAuthenticationEntryPointTests.java | 2 +- .../www/BasicAuthenticationFilterTests.java | 10 +- .../www/DigestAuthUtilsTests.java | 2 +- .../DigestAuthenticationEntryPointTests.java | 2 +- .../www/DigestAuthenticationFilterTests.java | 10 +- ...icationPrincipalArgumentResolverTests.java | 10 +- .../ConcurrentSessionFilterTests.java | 6 +- ...ecurityWebApplicationInitializerTests.java | 2 +- ...SessionSecurityContextRepositoryTests.java | 6 +- ...xtOnUpdateOrErrorResponseWrapperTests.java | 16 +-- ...SecurityContextPersistenceFilterTests.java | 6 +- ...extCallableProcessingInterceptorTests.java | 12 +- ...WebAsyncManagerIntegrationFilterTests.java | 16 +-- .../csrf/CookieCsrfTokenRepositoryTests.java | 6 +- .../csrf/CsrfAuthenticationStrategyTests.java | 12 +- .../security/web/csrf/CsrfFilterTests.java | 12 +- .../web/csrf/CsrfLogoutHandlerTests.java | 12 +- .../web/csrf/DefaultCsrfTokenTests.java | 2 +- .../HttpSessionCsrfTokenRepositoryTests.java | 6 +- .../csrf/LazyCsrfTokenRepositoryTests.java | 12 +- .../csrf/MissingCsrfTokenExceptionTests.java | 2 +- .../security/web/debug/DebugFilterTests.java | 12 +- .../firewall/DefaultHttpFirewallTests.java | 2 +- .../DefaultRequestRejectedHandlerTests.java | 2 +- .../web/firewall/FirewalledResponseTests.java | 6 +- ...HttpStatusRequestRejectedHandlerTests.java | 2 +- .../web/firewall/RequestWrapperTests.java | 6 +- .../web/firewall/StrictHttpFirewallTests.java | 2 +- .../web/header/HeaderWriterFilterTests.java | 8 +- .../CacheControlHeadersWriterTests.java | 6 +- .../ClearSiteDataHeaderWriterTests.java | 6 +- .../writers/CompositeHeaderWriterTests.java | 2 +- ...ontentSecurityPolicyHeaderWriterTests.java | 6 +- ...gatingRequestMatcherHeaderWriterTests.java | 12 +- .../FeaturePolicyHeaderWriterTests.java | 6 +- .../header/writers/HpkpHeaderWriterTests.java | 6 +- .../header/writers/HstsHeaderWriterTests.java | 6 +- .../PermissionsPolicyHeaderWriterTests.java | 6 +- .../ReferrerPolicyHeaderWriterTests.java | 6 +- .../writers/StaticHeaderWriterTests.java | 6 +- .../XContentTypeOptionsHeaderWriterTests.java | 6 +- .../XXssProtectionHeaderWriterTests.java | 6 +- ...equestParameterAllowFromStrategyTests.java | 6 +- .../FrameOptionsHeaderWriterTests.java | 12 +- .../RegExpAllowFromStrategyTests.java | 2 +- .../StaticAllowFromStrategyTests.java | 2 +- .../WhiteListedAllowFromStrategyTests.java | 2 +- .../XFrameOptionsHeaderWriterTests.java | 2 +- .../JaasApiIntegrationFilterTests.java | 10 +- .../web/jackson2/AbstractMixinTests.java | 4 +- .../web/jackson2/CookieMixinTests.java | 2 +- .../jackson2/DefaultCsrfTokenMixinTests.java | 2 +- .../DefaultSavedRequestMixinTests.java | 2 +- ...nticatedAuthenticationTokenMixinTests.java | 6 +- .../web/jackson2/SavedCookieMixinTests.java | 2 +- .../WebAuthenticationDetailsMixinTests.java | 2 +- ...icationPrincipalArgumentResolverTests.java | 10 +- .../CsrfTokenArgumentResolverTests.java | 12 +- ...tSecurityContextArgumentResolverTests.java | 10 +- ...icationPrincipalArgumentResolverTests.java | 12 +- ...tSecurityContextArgumentResolverTests.java | 12 +- .../CsrfRequestDataValueProcessorTests.java | 6 +- .../savedrequest/CookieRequestCacheTests.java | 2 +- .../DefaultSavedRequestTests.java | 2 +- .../HttpSessionRequestCacheTests.java | 2 +- .../RequestCacheAwareFilterTests.java | 2 +- .../web/savedrequest/SavedCookieTests.java | 6 +- .../SavedRequestAwareWrapperTests.java | 2 +- .../savedrequest/SimpleSavedRequestTests.java | 2 +- .../DefaultServerRedirectStrategyTests.java | 8 +- ...ngServerAuthenticationEntryPointTests.java | 8 +- ...ExchangeMatcherRedirectWebFilterTests.java | 2 +- .../web/server/WebFilterChainProxyTests.java | 2 +- .../web/server/WebFilterExchangeTests.java | 8 +- ...AnonymousAuthenticationWebFilterTests.java | 8 +- ...onverterServerWebExchangeMatcherTests.java | 12 +- .../AuthenticationWebFilterTests.java | 12 +- ...rverAuthenticationSuccessHandlerTests.java | 12 +- ...icServerAuthenticationEntryPointTests.java | 8 +- .../HttpStatusServerEntryPointTests.java | 6 +- ...thenticatedAuthenticationManagerTests.java | 2 +- ...ctServerAuthenticationEntryPointTests.java | 8 +- ...rverAuthenticationFailureHandlerTests.java | 8 +- ...rverAuthenticationSuccessHandlerTests.java | 8 +- ...ticationEntryPointFailureHandlerTests.java | 8 +- ...FormLoginAuthenticationConverterTests.java | 12 +- ...HttpBasicAuthenticationConverterTests.java | 2 +- ...erverX509AuthenticationConverterTests.java | 12 +- .../SwitchUserWebFilterTests.java | 12 +- .../DelegatingServerLogoutHandlerTests.java | 12 +- .../HeaderWriterServerLogoutHandlerTests.java | 2 +- ...urningServerLogoutSuccessHandlerTests.java | 2 +- .../logout/LogoutWebFilterTests.java | 8 +- .../AuthorizationWebFilterTests.java | 8 +- ...tingReactiveAuthorizationManagerTests.java | 6 +- .../ExceptionTranslationWebFilterTests.java | 12 +- ...pStatusServerAccessDeniedHandlerTests.java | 8 +- ...egatingServerAccessDeniedHandlerTests.java | 6 +- ...pServerSecurityContextRepositoryTests.java | 2 +- .../context/ReactorContextWebFilterTests.java | 12 +- ...ontextServerWebExchangeWebFilterTests.java | 2 +- ...nServerSecurityContextRepositoryTests.java | 2 +- .../CookieServerCsrfTokenRepositoryTests.java | 6 +- .../csrf/CsrfServerLogoutHandlerTests.java | 12 +- .../web/server/csrf/CsrfWebFilterTests.java | 8 +- ...SessionServerCsrfTokenRepositoryTests.java | 2 +- ...heControlServerHttpHeadersWriterTests.java | 2 +- ...rSiteDataServerHttpHeadersWriterTests.java | 2 +- ...CompositeServerHttpHeadersWriterTests.java | 12 +- ...ityPolicyServerHttpHeadersWriterTests.java | 6 +- ...urePolicyServerHttpHeadersWriterTests.java | 6 +- .../HttpHeaderWriterWebFilterTests.java | 12 +- ...onsPolicyServerHttpHeadersWriterTests.java | 6 +- ...rerPolicyServerHttpHeadersWriterTests.java | 6 +- .../StaticServerHttpHeadersWriterTests.java | 2 +- ...tSecurityServerHttpHeadersWriterTests.java | 2 +- ...peOptionsServerHttpHeadersWriterTests.java | 2 +- ...meOptionsServerHttpHeadersWriterTests.java | 6 +- ...rotectionServerHttpHeadersWriterTests.java | 2 +- .../DefaultCsrfServerTokenMixinTests.java | 2 +- .../CookieServerRequestCacheTests.java | 2 +- .../ServerRequestCacheWebFilterTests.java | 12 +- .../WebSessionServerRequestCacheTests.java | 2 +- .../HttpsRedirectWebFilterTests.java | 12 +- .../ui/LoginPageGeneratingWebFilterTests.java | 2 +- .../AndServerWebExchangeMatcherTests.java | 12 +- ...ediaTypeServerWebExchangeMatcherTests.java | 2 +- .../NegatedServerWebExchangeMatcherTests.java | 12 +- .../OrServerWebExchangeMatcherTests.java | 12 +- ...hMatcherServerWebExchangeMatcherTests.java | 12 +- .../ServerWebExchangeMatchersTests.java | 2 +- .../CsrfRequestDataValueProcessorTests.java | 6 +- .../util/matcher/MvcRequestMatcherTests.java | 12 +- ...yContextHolderAwareRequestFilterTests.java | 16 +-- ...ContextHolderAwareRequestWrapperTests.java | 6 +- ...ultSessionAuthenticationStrategyTests.java | 2 +- .../HttpSessionDestroyedEventTests.java | 6 +- .../HttpSessionEventPublisherTests.java | 2 +- .../SessionInformationExpiredEventTests.java | 2 +- .../session/SessionManagementFilterTests.java | 6 +- .../util/OnCommittedResponseWrapperTests.java | 12 +- .../web/util/TextEscapeUtilsTests.java | 6 +- .../web/util/ThrowableAnalyzerTests.java | 6 +- .../security/web/util/UrlUtilsTests.java | 2 +- .../util/matcher/AndRequestMatcherTests.java | 8 +- .../matcher/AntPathRequestMatcherTests.java | 8 +- .../DispatcherTypeRequestMatcherTests.java | 2 +- .../util/matcher/ELRequestMatcherTests.java | 2 +- .../util/matcher/IpAddressMatcherTests.java | 6 +- ...diaTypeRequestMatcherRequestHCNSTests.java | 6 +- .../matcher/MediaTypeRequestMatcherTests.java | 12 +- .../matcher/NegatedRequestMatcherTests.java | 8 +- .../util/matcher/OrRequestMatcherTests.java | 8 +- .../matcher/RegexRequestMatcherTests.java | 8 +- .../RequestHeaderRequestMatcherTests.java | 6 +- 999 files changed, 3088 insertions(+), 3092 deletions(-) diff --git a/acl/src/test/java/org/springframework/security/acls/AclFormattingUtilsTests.java b/acl/src/test/java/org/springframework/security/acls/AclFormattingUtilsTests.java index 0bbcdcf506..8879c3f000 100644 --- a/acl/src/test/java/org/springframework/security/acls/AclFormattingUtilsTests.java +++ b/acl/src/test/java/org/springframework/security/acls/AclFormattingUtilsTests.java @@ -16,7 +16,7 @@ package org.springframework.security.acls; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.domain.AclFormattingUtils; import org.springframework.security.acls.model.Permission; 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 844a2d4d86..97d7f4f721 100644 --- a/acl/src/test/java/org/springframework/security/acls/AclPermissionCacheOptimizerTests.java +++ b/acl/src/test/java/org/springframework/security/acls/AclPermissionCacheOptimizerTests.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.domain.ObjectIdentityImpl; import org.springframework.security.acls.model.AclService; diff --git a/acl/src/test/java/org/springframework/security/acls/AclPermissionEvaluatorTests.java b/acl/src/test/java/org/springframework/security/acls/AclPermissionEvaluatorTests.java index a29c3ab3be..c94a15b111 100644 --- a/acl/src/test/java/org/springframework/security/acls/AclPermissionEvaluatorTests.java +++ b/acl/src/test/java/org/springframework/security/acls/AclPermissionEvaluatorTests.java @@ -18,7 +18,7 @@ package org.springframework.security.acls; import java.util.Locale; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.model.Acl; import org.springframework.security.acls.model.AclService; diff --git a/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java b/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java index 296e306d5f..1322758589 100644 --- a/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java +++ b/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.access.SecurityConfig; diff --git a/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java b/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java index 4d2c04eee4..d8f4f491b0 100644 --- a/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java +++ b/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.ConfigAttribute; diff --git a/acl/src/test/java/org/springframework/security/acls/domain/AccessControlImplEntryTests.java b/acl/src/test/java/org/springframework/security/acls/domain/AccessControlImplEntryTests.java index e8155e76e3..2433c797d8 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/AccessControlImplEntryTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/AccessControlImplEntryTests.java @@ -16,7 +16,7 @@ package org.springframework.security.acls.domain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.model.AccessControlEntry; import org.springframework.security.acls.model.Acl; diff --git a/acl/src/test/java/org/springframework/security/acls/domain/AclAuthorizationStrategyImplTests.java b/acl/src/test/java/org/springframework/security/acls/domain/AclAuthorizationStrategyImplTests.java index 992a036569..5d7201251f 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/AclAuthorizationStrategyImplTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/AclAuthorizationStrategyImplTests.java @@ -18,12 +18,12 @@ package org.springframework.security.acls.domain; import java.util.Arrays; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.acls.model.Acl; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -37,7 +37,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AclAuthorizationStrategyImplTests { @Mock @@ -47,7 +47,7 @@ public class AclAuthorizationStrategyImplTests { AclAuthorizationStrategyImpl strategy; - @Before + @BeforeEach public void setup() { this.authority = new SimpleGrantedAuthority("ROLE_AUTH"); TestingAuthenticationToken authentication = new TestingAuthenticationToken("foo", "bar", @@ -56,7 +56,7 @@ public class AclAuthorizationStrategyImplTests { SecurityContextHolder.getContext().setAuthentication(authentication); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java b/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java index 4d14294b1a..f39de060fc 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java @@ -22,9 +22,9 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.model.AccessControlEntry; import org.springframework.security.acls.model.Acl; @@ -83,7 +83,7 @@ public class AclImplTests { private DefaultPermissionFactory permissionFactory; - @Before + @BeforeEach public void setUp() { SecurityContextHolder.getContext().setAuthentication(this.auth); this.authzStrategy = mock(AclAuthorizationStrategy.class); @@ -93,7 +93,7 @@ public class AclImplTests { this.permissionFactory = new DefaultPermissionFactory(); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java b/acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java index 844f2d10e3..175fa6a0e5 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java @@ -16,9 +16,9 @@ package org.springframework.security.acls.domain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.acls.model.Acl; @@ -43,12 +43,12 @@ public class AclImplementationSecurityCheckTests { private static final String TARGET_CLASS = "org.springframework.security.acls.TargetObject"; - @Before + @BeforeEach public void setUp() { SecurityContextHolder.clearContext(); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/acl/src/test/java/org/springframework/security/acls/domain/AuditLoggerTests.java b/acl/src/test/java/org/springframework/security/acls/domain/AuditLoggerTests.java index e2abb35c01..dec3b3af78 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/AuditLoggerTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/AuditLoggerTests.java @@ -19,9 +19,9 @@ package org.springframework.security.acls.domain; import java.io.ByteArrayOutputStream; import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.model.AccessControlEntry; import org.springframework.security.acls.model.AuditableAccessControlEntry; @@ -45,7 +45,7 @@ public class AuditLoggerTests { private AuditableAccessControlEntry ace; - @Before + @BeforeEach public void setUp() { this.logger = new ConsoleAuditLogger(); this.ace = mock(AuditableAccessControlEntry.class); @@ -53,7 +53,7 @@ public class AuditLoggerTests { System.setOut(new PrintStream(this.bytes)); } - @After + @AfterEach public void tearDown() { System.setOut(this.console); this.bytes.reset(); diff --git a/acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityImplTests.java b/acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityImplTests.java index 539fff692d..a363ecdecc 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityImplTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityImplTests.java @@ -16,7 +16,7 @@ package org.springframework.security.acls.domain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.model.ObjectIdentity; diff --git a/acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java b/acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java index b6787f893c..7c0739ef86 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java @@ -16,7 +16,7 @@ package org.springframework.security.acls.domain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.model.ObjectIdentity; import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy; diff --git a/acl/src/test/java/org/springframework/security/acls/domain/PermissionTests.java b/acl/src/test/java/org/springframework/security/acls/domain/PermissionTests.java index 5aef8e4c74..76394ed679 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/PermissionTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/PermissionTests.java @@ -16,8 +16,8 @@ package org.springframework.security.acls.domain; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.model.Permission; @@ -32,7 +32,7 @@ public class PermissionTests { private DefaultPermissionFactory permissionFactory; - @Before + @BeforeEach public void createPermissionfactory() { this.permissionFactory = new DefaultPermissionFactory(); } diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/AbstractBasicLookupStrategyTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/AbstractBasicLookupStrategyTests.java index d1a20e6352..4a6b1d695f 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/AbstractBasicLookupStrategyTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/AbstractBasicLookupStrategyTests.java @@ -26,11 +26,11 @@ import javax.sql.DataSource; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Ehcache; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.security.acls.TargetObject; @@ -81,19 +81,19 @@ public abstract class AbstractBasicLookupStrategyTests { public abstract DataSource getDataSource(); - @BeforeClass + @BeforeAll public static void initCacheManaer() { cacheManager = CacheManager.create(); cacheManager.addCache(new Cache("basiclookuptestcache", 500, false, false, 30, 30)); } - @AfterClass + @AfterAll public static void shutdownCacheManager() { cacheManager.removalAll(); cacheManager.shutdown(); } - @Before + @BeforeEach public void populateDatabase() { String query = "INSERT INTO acl_sid(ID,PRINCIPAL,SID) VALUES (1,1,'ben');" + "INSERT INTO acl_class(ID,CLASS) VALUES (2,'" + TARGET_CLASS + "');" @@ -107,7 +107,7 @@ public abstract class AbstractBasicLookupStrategyTests { getJdbcTemplate().execute(query); } - @Before + @BeforeEach public void initializeBeans() { this.strategy = new BasicLookupStrategy(getDataSource(), aclCache(), aclAuthStrategy(), new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger())); @@ -123,7 +123,7 @@ public abstract class AbstractBasicLookupStrategyTests { new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_USER"))); } - @After + @AfterEach public void emptyDatabase() { String query = "DELETE FROM acl_entry;" + "DELETE FROM acl_object_identity WHERE ID = 9;" + "DELETE FROM acl_object_identity WHERE ID = 8;" + "DELETE FROM acl_object_identity WHERE ID = 7;" diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/AclClassIdUtilsTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/AclClassIdUtilsTests.java index 49b4e12b1a..1460f33cc4 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/AclClassIdUtilsTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/AclClassIdUtilsTests.java @@ -22,11 +22,11 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.UUID; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.convert.ConversionService; @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; * * @author paulwheeler */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AclClassIdUtilsTests { private static final Long DEFAULT_IDENTIFIER = 999L; @@ -56,7 +56,7 @@ public class AclClassIdUtilsTests { private AclClassIdUtils aclClassIdUtils; - @Before + @BeforeEach public void setUp() { this.aclClassIdUtils = new AclClassIdUtils(); } diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java index 4e117ee5c0..b756b2db79 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java @@ -18,8 +18,8 @@ package org.springframework.security.acls.jdbc; import javax.sql.DataSource; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.springframework.jdbc.core.JdbcTemplate; @@ -33,12 +33,12 @@ public class BasicLookupStrategyTests extends AbstractBasicLookupStrategyTests { private static final BasicLookupStrategyTestsDbHelper DATABASE_HELPER = new BasicLookupStrategyTestsDbHelper(); - @BeforeClass + @BeforeAll public static void createDatabase() throws Exception { DATABASE_HELPER.createDatabase(); } - @AfterClass + @AfterAll public static void dropDatabase() { DATABASE_HELPER.getDataSource().destroy(); } diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java index 2db9b65608..63349e784e 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java @@ -22,10 +22,10 @@ import java.util.Map; import javax.sql.DataSource; import junit.framework.Assert; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.ConversionFailedException; import org.springframework.core.convert.support.DefaultConversionService; @@ -60,18 +60,18 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku return DATABASE_HELPER.getDataSource(); } - @BeforeClass + @BeforeAll public static void createDatabase() throws Exception { DATABASE_HELPER.createDatabase(); } - @AfterClass + @AfterAll public static void dropDatabase() { DATABASE_HELPER.getDataSource().destroy(); } @Override - @Before + @BeforeEach public void initializeBeans() { super.initializeBeans(); this.uuidEnabledStrategy = new BasicLookupStrategy(getDataSource(), aclCache(), aclAuthStrategy(), @@ -81,7 +81,7 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku this.uuidEnabledStrategy.setConversionService(new DefaultConversionService()); } - @Before + @BeforeEach public void populateDatabaseForAclClassTypeTests() { String query = "INSERT INTO acl_class(ID,CLASS,CLASS_ID_TYPE) VALUES (3,'" + TARGET_CLASS_WITH_UUID + "', 'java.util.UUID');" diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java index 8c2a3a4603..35545abae2 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java @@ -26,14 +26,14 @@ import java.util.List; import net.sf.ehcache.Ehcache; import net.sf.ehcache.Element; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.acls.domain.AclAuthorizationStrategy; import org.springframework.security.acls.domain.AclAuthorizationStrategyImpl; @@ -62,7 +62,7 @@ import static org.mockito.Mockito.verify; * * @author Andrei Stefan */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class EhCacheBasedAclCacheTests { private static final String TARGET_CLASS = "org.springframework.security.acls.TargetObject"; @@ -77,7 +77,7 @@ public class EhCacheBasedAclCacheTests { private MutableAcl acl; - @Before + @BeforeEach public void setup() { this.myCache = new EhCacheBasedAclCache(this.cache, new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()), @@ -89,7 +89,7 @@ public class EhCacheBasedAclCacheTests { this.acl = new AclImpl(identity, 1L, aclAuthorizationStrategy, new ConsoleAuditLogger()); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcAclServiceTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcAclServiceTests.java index 7894a6dce0..ceb080f8a5 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcAclServiceTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcAclServiceTests.java @@ -25,12 +25,12 @@ import java.util.UUID; import javax.sql.DataSource; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.jdbc.core.JdbcOperations; import org.springframework.jdbc.core.RowMapper; @@ -56,7 +56,7 @@ import static org.mockito.BDDMockito.given; * * @author Nena Raab */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class JdbcAclServiceTests { private EmbeddedDatabase embeddedDatabase; @@ -74,13 +74,13 @@ public class JdbcAclServiceTests { private JdbcAclService aclService; - @Before + @BeforeEach public void setUp() { this.aclService = new JdbcAclService(this.jdbcOperations, this.lookupStrategy); this.aclServiceIntegration = new JdbcAclService(this.embeddedDatabase, this.lookupStrategy); } - @Before + @BeforeEach public void setUpEmbeddedDatabase() { // @formatter:off this.embeddedDatabase = new EmbeddedDatabaseBuilder() @@ -90,7 +90,7 @@ public class JdbcAclServiceTests { // @formatter:on } - @After + @AfterEach public void tearDownEmbeddedDatabase() { this.embeddedDatabase.shutdown(); } diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java index 4b4e3b0fa9..a7a57638fc 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java @@ -22,7 +22,7 @@ import java.util.Map; import javax.sql.DataSource; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ClassPathResource; diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTestsWithAclClassId.java b/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTestsWithAclClassId.java index ab69977a56..bd82ab4fa5 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTestsWithAclClassId.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTestsWithAclClassId.java @@ -18,7 +18,7 @@ package org.springframework.security.acls.jdbc; import java.util.UUID; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.TargetObjectWithUUID; import org.springframework.security.acls.domain.ObjectIdentityImpl; diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/SpringCacheBasedAclCacheTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/SpringCacheBasedAclCacheTests.java index aae9980362..5fc3bc3547 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/SpringCacheBasedAclCacheTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/SpringCacheBasedAclCacheTests.java @@ -18,9 +18,9 @@ package org.springframework.security.acls.jdbc; import java.util.Map; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; @@ -56,7 +56,7 @@ public class SpringCacheBasedAclCacheTests { private static CacheManager cacheManager; - @BeforeClass + @BeforeAll public static void initCacheManaer() { cacheManager = new ConcurrentMapCacheManager(); // Use disk caching immediately (to test for serialization issue reported in @@ -64,7 +64,7 @@ public class SpringCacheBasedAclCacheTests { cacheManager.getCache("springcasebasedacltests"); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/acl/src/test/java/org/springframework/security/acls/sid/SidRetrievalStrategyTests.java b/acl/src/test/java/org/springframework/security/acls/sid/SidRetrievalStrategyTests.java index 5922f8f670..6467cc929f 100644 --- a/acl/src/test/java/org/springframework/security/acls/sid/SidRetrievalStrategyTests.java +++ b/acl/src/test/java/org/springframework/security/acls/sid/SidRetrievalStrategyTests.java @@ -18,7 +18,7 @@ package org.springframework.security.acls.sid; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.hierarchicalroles.RoleHierarchy; import org.springframework.security.acls.domain.GrantedAuthoritySid; diff --git a/acl/src/test/java/org/springframework/security/acls/sid/SidTests.java b/acl/src/test/java/org/springframework/security/acls/sid/SidTests.java index ad6f8665a6..50c1ba685b 100644 --- a/acl/src/test/java/org/springframework/security/acls/sid/SidTests.java +++ b/acl/src/test/java/org/springframework/security/acls/sid/SidTests.java @@ -19,7 +19,7 @@ package org.springframework.security.acls.sid; import java.util.Collection; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.acls.domain.GrantedAuthoritySid; import org.springframework.security.acls.domain.PrincipalSid; diff --git a/aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java b/aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java index f67df408f7..c749614815 100644 --- a/aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java +++ b/aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java @@ -20,9 +20,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -74,7 +74,7 @@ public class AnnotationSecurityAspectTests { private PrePostSecured prePostSecured = new PrePostSecured(); - @Before + @BeforeEach public final void setUp() { MockitoAnnotations.initMocks(this); this.interceptor = new AspectJMethodSecurityInterceptor(); @@ -88,7 +88,7 @@ public class AnnotationSecurityAspectTests { secAspect.setSecurityInterceptor(this.interceptor); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java b/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java index ef7a451d2e..242d32a730 100644 --- a/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java +++ b/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java @@ -22,7 +22,7 @@ import java.util.Map; import org.jasig.cas.client.validation.Assertion; import org.jasig.cas.client.validation.AssertionImpl; import org.jasig.cas.client.validation.TicketValidator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.authentication.BadCredentialsException; diff --git a/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationTokenTests.java b/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationTokenTests.java index 6585c8c864..8ac076830b 100644 --- a/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationTokenTests.java +++ b/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationTokenTests.java @@ -21,7 +21,7 @@ import java.util.List; import org.jasig.cas.client.validation.Assertion; import org.jasig.cas.client.validation.AssertionImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; diff --git a/cas/src/test/java/org/springframework/security/cas/authentication/EhCacheBasedTicketCacheTests.java b/cas/src/test/java/org/springframework/security/cas/authentication/EhCacheBasedTicketCacheTests.java index c4e8b0602c..c824eef4bc 100644 --- a/cas/src/test/java/org/springframework/security/cas/authentication/EhCacheBasedTicketCacheTests.java +++ b/cas/src/test/java/org/springframework/security/cas/authentication/EhCacheBasedTicketCacheTests.java @@ -19,9 +19,9 @@ package org.springframework.security.cas.authentication; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Ehcache; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -35,13 +35,13 @@ public class EhCacheBasedTicketCacheTests extends AbstractStatelessTicketCacheTe private static CacheManager cacheManager; - @BeforeClass + @BeforeAll public static void initCacheManaer() { cacheManager = CacheManager.create(); cacheManager.addCache(new Cache("castickets", 500, false, false, 30, 30)); } - @AfterClass + @AfterAll public static void shutdownCacheManager() { cacheManager.removalAll(); cacheManager.shutdown(); diff --git a/cas/src/test/java/org/springframework/security/cas/authentication/NullStatelessTicketCacheTests.java b/cas/src/test/java/org/springframework/security/cas/authentication/NullStatelessTicketCacheTests.java index c48644644b..f5a87e5c4e 100644 --- a/cas/src/test/java/org/springframework/security/cas/authentication/NullStatelessTicketCacheTests.java +++ b/cas/src/test/java/org/springframework/security/cas/authentication/NullStatelessTicketCacheTests.java @@ -16,7 +16,7 @@ package org.springframework.security.cas.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/cas/src/test/java/org/springframework/security/cas/authentication/SpringCacheBasedTicketCacheTests.java b/cas/src/test/java/org/springframework/security/cas/authentication/SpringCacheBasedTicketCacheTests.java index bc48f9ac27..e27344a9ce 100644 --- a/cas/src/test/java/org/springframework/security/cas/authentication/SpringCacheBasedTicketCacheTests.java +++ b/cas/src/test/java/org/springframework/security/cas/authentication/SpringCacheBasedTicketCacheTests.java @@ -16,8 +16,8 @@ package org.springframework.security.cas.authentication; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.cache.CacheManager; import org.springframework.cache.concurrent.ConcurrentMapCacheManager; @@ -36,7 +36,7 @@ public class SpringCacheBasedTicketCacheTests extends AbstractStatelessTicketCac private static CacheManager cacheManager; - @BeforeClass + @BeforeAll public static void initCacheManaer() { cacheManager = new ConcurrentMapCacheManager(); cacheManager.getCache("castickets"); diff --git a/cas/src/test/java/org/springframework/security/cas/jackson2/CasAuthenticationTokenMixinTests.java b/cas/src/test/java/org/springframework/security/cas/jackson2/CasAuthenticationTokenMixinTests.java index 4eed00cbe9..ce333d4d83 100644 --- a/cas/src/test/java/org/springframework/security/cas/jackson2/CasAuthenticationTokenMixinTests.java +++ b/cas/src/test/java/org/springframework/security/cas/jackson2/CasAuthenticationTokenMixinTests.java @@ -27,8 +27,8 @@ import org.jasig.cas.client.authentication.AttributePrincipalImpl; import org.jasig.cas.client.validation.Assertion; import org.jasig.cas.client.validation.AssertionImpl; import org.json.JSONException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.cas.authentication.CasAuthenticationToken; @@ -92,7 +92,7 @@ public class CasAuthenticationTokenMixinTests { protected ObjectMapper mapper; - @Before + @BeforeEach public void setup() { this.mapper = new ObjectMapper(); ClassLoader loader = getClass().getClassLoader(); diff --git a/cas/src/test/java/org/springframework/security/cas/userdetails/GrantedAuthorityFromAssertionAttributesUserDetailsServiceTests.java b/cas/src/test/java/org/springframework/security/cas/userdetails/GrantedAuthorityFromAssertionAttributesUserDetailsServiceTests.java index e33e8a441e..3db719dcc2 100644 --- a/cas/src/test/java/org/springframework/security/cas/userdetails/GrantedAuthorityFromAssertionAttributesUserDetailsServiceTests.java +++ b/cas/src/test/java/org/springframework/security/cas/userdetails/GrantedAuthorityFromAssertionAttributesUserDetailsServiceTests.java @@ -23,7 +23,7 @@ import java.util.Set; import org.jasig.cas.client.authentication.AttributePrincipal; import org.jasig.cas.client.validation.Assertion; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.cas.authentication.CasAssertionAuthenticationToken; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationEntryPointTests.java b/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationEntryPointTests.java index c61d372944..5fb0e7c7f8 100644 --- a/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationEntryPointTests.java +++ b/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationEntryPointTests.java @@ -18,7 +18,7 @@ package org.springframework.security.cas.web; import java.net.URLEncoder; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java b/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java index f161e98473..fab4d2ed1d 100644 --- a/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java +++ b/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java @@ -19,8 +19,8 @@ package org.springframework.security.cas.web; import javax.servlet.FilterChain; import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -52,7 +52,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; */ public class CasAuthenticationFilterTests { - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/cas/src/test/java/org/springframework/security/cas/web/ServicePropertiesTests.java b/cas/src/test/java/org/springframework/security/cas/web/ServicePropertiesTests.java index eba5b1f667..fc52e1d6a5 100644 --- a/cas/src/test/java/org/springframework/security/cas/web/ServicePropertiesTests.java +++ b/cas/src/test/java/org/springframework/security/cas/web/ServicePropertiesTests.java @@ -16,7 +16,7 @@ package org.springframework.security.cas.web; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.cas.SamlServiceProperties; import org.springframework.security.cas.ServiceProperties; diff --git a/cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java b/cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java index d7d95ea3a7..893d256775 100644 --- a/cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java +++ b/cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java @@ -18,9 +18,9 @@ package org.springframework.security.cas.web.authentication; import java.util.regex.Pattern; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.GenericXmlApplicationContext; @@ -45,7 +45,7 @@ public class DefaultServiceAuthenticationDetailsTests { private ConfigurableApplicationContext context; - @Before + @BeforeEach public void setUp() { this.casServiceUrl = "https://localhost:8443/j_spring_security_cas"; this.request = new MockHttpServletRequest(); @@ -57,7 +57,7 @@ public class DefaultServiceAuthenticationDetailsTests { .createArtifactPattern(ServiceProperties.DEFAULT_CAS_ARTIFACT_PARAMETER); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderBuilderSecurityBuilderTests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderBuilderSecurityBuilderTests.java index 36d1d636ee..9ddbf72039 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderBuilderSecurityBuilderTests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderBuilderSecurityBuilderTests.java @@ -24,7 +24,7 @@ import java.util.List; import javax.naming.directory.SearchControls; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderConfigurerTests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderConfigurerTests.java index ea34da288e..2dba4a545a 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderConfigurerTests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderConfigurerTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication.ldap; import java.util.Collections; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/NamespaceLdapAuthenticationProviderTests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/NamespaceLdapAuthenticationProviderTests.java index 3369a4ed8a..9522554b72 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/NamespaceLdapAuthenticationProviderTests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/NamespaceLdapAuthenticationProviderTests.java @@ -21,7 +21,7 @@ import java.util.HashSet; import java.util.Set; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.core.DirContextOperations; diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/HelloRSocketITests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/HelloRSocketITests.java index cb9ba6c939..b46c1e41ae 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/HelloRSocketITests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/HelloRSocketITests.java @@ -24,10 +24,10 @@ import io.rsocket.exceptions.RejectedSetupException; import io.rsocket.frame.decoder.PayloadDecoder; import io.rsocket.transport.netty.server.CloseableChannel; import io.rsocket.transport.netty.server.TcpServerTransport; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -44,7 +44,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder; import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata; import org.springframework.stereotype.Controller; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Rob Winch */ @ContextConfiguration -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class HelloRSocketITests { @Autowired @@ -69,7 +69,7 @@ public class HelloRSocketITests { private RSocketRequester requester; - @Before + @BeforeEach public void setup() { // @formatter:off this.server = RSocketServer.create() @@ -83,7 +83,7 @@ public class HelloRSocketITests { // @formatter:on } - @After + @AfterEach public void dispose() { this.requester.rsocket().dispose(); this.server.dispose(); diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java index 16fb7da016..ba7b4b7172 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java @@ -25,10 +25,10 @@ import io.rsocket.frame.decoder.PayloadDecoder; import io.rsocket.metadata.WellKnownMimeType; import io.rsocket.transport.netty.server.CloseableChannel; import io.rsocket.transport.netty.server.TcpServerTransport; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; @@ -49,7 +49,7 @@ import org.springframework.security.rsocket.metadata.BearerTokenAuthenticationEn import org.springframework.security.rsocket.metadata.BearerTokenMetadata; import org.springframework.stereotype.Controller; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; @@ -62,7 +62,7 @@ import static org.mockito.Mockito.mock; * @author Rob Winch */ @ContextConfiguration -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class JwtITests { @Autowired @@ -81,7 +81,7 @@ public class JwtITests { private RSocketRequester requester; - @Before + @BeforeEach public void setup() { // @formatter:off this.server = RSocketServer.create() @@ -95,7 +95,7 @@ public class JwtITests { // @formatter:on } - @After + @AfterEach public void dispose() { this.requester.rsocket().dispose(); this.server.dispose(); diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerConnectionITests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerConnectionITests.java index eb7e8a551b..3e9da24ff8 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerConnectionITests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerConnectionITests.java @@ -25,10 +25,10 @@ import io.rsocket.exceptions.RejectedSetupException; import io.rsocket.frame.decoder.PayloadDecoder; import io.rsocket.transport.netty.server.CloseableChannel; import io.rsocket.transport.netty.server.TcpServerTransport; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -47,7 +47,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder; import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata; import org.springframework.stereotype.Controller; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Ebert Toribio */ @ContextConfiguration -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class RSocketMessageHandlerConnectionITests { @Autowired @@ -76,7 +76,7 @@ public class RSocketMessageHandlerConnectionITests { private RSocketRequester requester; - @Before + @BeforeEach public void setup() { // @formatter:off this.server = RSocketServer.create() @@ -90,7 +90,7 @@ public class RSocketMessageHandlerConnectionITests { // @formatter:on } - @After + @AfterEach public void dispose() { this.requester.rsocket().dispose(); this.server.dispose(); diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java index 774d0b611a..d67477400d 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java @@ -25,10 +25,10 @@ import io.rsocket.exceptions.ApplicationErrorException; import io.rsocket.frame.decoder.PayloadDecoder; import io.rsocket.transport.netty.server.CloseableChannel; import io.rsocket.transport.netty.server.TcpServerTransport; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -49,7 +49,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder; import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata; import org.springframework.stereotype.Controller; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Rob Winch */ @ContextConfiguration -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class RSocketMessageHandlerITests { @Autowired @@ -74,7 +74,7 @@ public class RSocketMessageHandlerITests { private RSocketRequester requester; - @Before + @BeforeEach public void setup() { // @formatter:off this.server = RSocketServer.create() @@ -94,7 +94,7 @@ public class RSocketMessageHandlerITests { // @formatter:on } - @After + @AfterEach public void dispose() { this.requester.rsocket().dispose(); this.server.dispose(); diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/SimpleAuthenticationITests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/SimpleAuthenticationITests.java index a2b195102f..4896522dee 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/SimpleAuthenticationITests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/SimpleAuthenticationITests.java @@ -25,10 +25,10 @@ import io.rsocket.frame.decoder.PayloadDecoder; import io.rsocket.metadata.WellKnownMimeType; import io.rsocket.transport.netty.server.CloseableChannel; import io.rsocket.transport.netty.server.TcpServerTransport; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -47,7 +47,7 @@ import org.springframework.security.rsocket.metadata.SimpleAuthenticationEncoder import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata; import org.springframework.stereotype.Controller; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; @@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Rob Winch */ @ContextConfiguration -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class SimpleAuthenticationITests { @Autowired @@ -74,7 +74,7 @@ public class SimpleAuthenticationITests { private RSocketRequester requester; - @Before + @BeforeEach public void setup() { // @formatter:off this.server = RSocketServer.create() @@ -88,7 +88,7 @@ public class SimpleAuthenticationITests { // @formatter:on } - @After + @AfterEach public void dispose() { this.requester.rsocket().dispose(); this.server.dispose(); diff --git a/config/src/integration-test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java b/config/src/integration-test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java index 1a6f26c4bc..43b2909477 100644 --- a/config/src/integration-test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java +++ b/config/src/integration-test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java @@ -18,8 +18,8 @@ package org.springframework.security.config.ldap; import java.text.MessageFormat; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationContextException; import org.springframework.security.authentication.AuthenticationManager; @@ -39,7 +39,7 @@ public class LdapProviderBeanDefinitionParserTests { InMemoryXmlApplicationContext appCtx; - @After + @AfterEach public void closeAppContext() { if (this.appCtx != null) { this.appCtx.close(); diff --git a/config/src/integration-test/java/org/springframework/security/config/ldap/LdapServerBeanDefinitionParserTests.java b/config/src/integration-test/java/org/springframework/security/config/ldap/LdapServerBeanDefinitionParserTests.java index 032a388401..298282ee3b 100644 --- a/config/src/integration-test/java/org/springframework/security/config/ldap/LdapServerBeanDefinitionParserTests.java +++ b/config/src/integration-test/java/org/springframework/security/config/ldap/LdapServerBeanDefinitionParserTests.java @@ -19,8 +19,8 @@ package org.springframework.security.config.ldap; import java.io.IOException; import java.net.ServerSocket; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.ldap.core.LdapTemplate; import org.springframework.security.config.BeanIds; @@ -39,7 +39,7 @@ public class LdapServerBeanDefinitionParserTests { InMemoryXmlApplicationContext appCtx; - @After + @AfterEach public void closeAppContext() { if (this.appCtx != null) { this.appCtx.close(); diff --git a/config/src/integration-test/java/org/springframework/security/config/ldap/LdapUserServiceBeanDefinitionParserTests.java b/config/src/integration-test/java/org/springframework/security/config/ldap/LdapUserServiceBeanDefinitionParserTests.java index e9c8c32a17..5dbc35e0da 100644 --- a/config/src/integration-test/java/org/springframework/security/config/ldap/LdapUserServiceBeanDefinitionParserTests.java +++ b/config/src/integration-test/java/org/springframework/security/config/ldap/LdapUserServiceBeanDefinitionParserTests.java @@ -18,8 +18,8 @@ package org.springframework.security.config.ldap; import java.util.Set; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.Element; import org.springframework.security.config.util.InMemoryXmlApplicationContext; @@ -47,7 +47,7 @@ public class LdapUserServiceBeanDefinitionParserTests { private InMemoryXmlApplicationContext appCtx; - @After + @AfterEach public void closeAppContext() { if (this.appCtx != null) { this.appCtx.close(); diff --git a/config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java b/config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java index d570897460..edd33b4b10 100644 --- a/config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java @@ -23,9 +23,9 @@ import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.mock.web.MockHttpServletRequest; @@ -55,14 +55,14 @@ public class FilterChainProxyConfigTests { private ClassPathXmlApplicationContext appCtx; - @Before + @BeforeEach public void loadContext() { System.setProperty("sec1235.pattern1", "/login"); System.setProperty("sec1235.pattern2", "/logout"); this.appCtx = new ClassPathXmlApplicationContext("org/springframework/security/util/filtertest-valid.xml"); } - @After + @AfterEach public void closeContext() { if (this.appCtx != null) { this.appCtx.close(); diff --git a/config/src/test/java/org/springframework/security/config/InvalidConfigurationTests.java b/config/src/test/java/org/springframework/security/config/InvalidConfigurationTests.java index 8ae7e61db1..ba8313406f 100644 --- a/config/src/test/java/org/springframework/security/config/InvalidConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/InvalidConfigurationTests.java @@ -16,8 +16,8 @@ package org.springframework.security.config; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; @@ -39,7 +39,7 @@ public class InvalidConfigurationTests { private InMemoryXmlApplicationContext appContext; - @After + @AfterEach public void closeAppContext() { if (this.appContext != null) { this.appContext.close(); 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 4249c5af10..2f5079640e 100644 --- a/config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java +++ b/config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java @@ -17,12 +17,12 @@ package org.springframework.security.config; import org.apache.commons.logging.Log; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Answers; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; import org.springframework.security.config.util.InMemoryXmlApplicationContext; @@ -40,7 +40,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 3.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityNamespaceHandlerTests { // @formatter:off diff --git a/config/src/test/java/org/springframework/security/config/annotation/ObjectPostProcessorTests.java b/config/src/test/java/org/springframework/security/config/annotation/ObjectPostProcessorTests.java index 03da3c1814..8a23aaab2f 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/ObjectPostProcessorTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/ObjectPostProcessorTests.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThatObject; diff --git a/config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterClosureTests.java b/config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterClosureTests.java index b98c51df78..f8c6c97f6d 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterClosureTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterClosureTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterTests.java b/config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterTests.java index 9e6aeba683..888188f961 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.annotation; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.Ordered; @@ -27,7 +27,7 @@ public class SecurityConfigurerAdapterTests { ConcereteSecurityConfigurerAdapter adapter; - @Before + @BeforeEach public void setup() { this.adapter = new ConcereteSecurityConfigurerAdapter(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/AuthenticationManagerBuilderTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/AuthenticationManagerBuilderTests.java index 14044109ec..1ed9449d66 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/AuthenticationManagerBuilderTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/AuthenticationManagerBuilderTests.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.Properties; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationManagerTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationManagerTests.java index f1d828d7e2..7cc7bab327 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationManagerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationManagerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.authentication; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationProviderTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationProviderTests.java index f29882cea9..0a9cb6acd0 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationProviderTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationProviderTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.authentication; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceJdbcUserServiceTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceJdbcUserServiceTests.java index 86e28e1003..ef3f1683c7 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceJdbcUserServiceTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceJdbcUserServiceTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication; import javax.sql.DataSource; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespacePasswordEncoderTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespacePasswordEncoderTests.java index 91759cd703..f19a90e439 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespacePasswordEncoderTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/NamespacePasswordEncoderTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication; import javax.sql.DataSource; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/PasswordEncoderConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/PasswordEncoderConfigurerTests.java index 456efd48f6..258f80ec7a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/PasswordEncoderConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/PasswordEncoderConfigurerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.authentication; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationPublishTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationPublishTests.java index 3c6ec39bf5..c313502b36 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationPublishTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationPublishTests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.annotation.authentication.configuration; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -29,14 +29,14 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio import org.springframework.security.authentication.event.AuthenticationSuccessEvent; import org.springframework.security.config.MockEventListener; import org.springframework.security.config.users.AuthenticationTestConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; /** * @author Rob Winch */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class AuthenticationConfigurationPublishTests { @Autowired diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationTests.java index d410060767..9e2f7c4faa 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationTests.java @@ -20,9 +20,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.junit.After; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.aop.framework.ProxyFactoryBean; import org.springframework.beans.factory.annotation.Autowired; @@ -79,7 +79,7 @@ public class AuthenticationConfigurationTests { @Autowired(required = false) private Service service; - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/EnableGlobalAuthenticationTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/EnableGlobalAuthenticationTests.java index 8a5e0db601..bc1f54fa74 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/EnableGlobalAuthenticationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/EnableGlobalAuthenticationTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.authentication.configuration; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurerTests.java index 40e9f8e149..54d57347c5 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurerTests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.annotation.authentication.configurers.ldap; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper; @@ -29,7 +29,7 @@ public class LdapAuthenticationProviderConfigurerTests { private LdapAuthenticationProviderConfigurer configurer; - @Before + @BeforeEach public void setUp() { this.configurer = new LdapAuthenticationProviderConfigurer<>(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/provisioning/UserDetailsManagerConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/provisioning/UserDetailsManagerConfigurerTests.java index ba43d04f0c..de5240661a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/provisioning/UserDetailsManagerConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/provisioning/UserDetailsManagerConfigurerTests.java @@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.authentication.configurer import java.util.Arrays; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.core.authority.SimpleGrantedAuthority; @@ -36,7 +36,7 @@ public class UserDetailsManagerConfigurerTests { private InMemoryUserDetailsManager userDetailsManager; - @Before + @BeforeEach public void setup() { this.userDetailsManager = new InMemoryUserDetailsManager(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/configuration/AutowireBeanFactoryObjectPostProcessorTests.java b/config/src/test/java/org/springframework/security/config/annotation/configuration/AutowireBeanFactoryObjectPostProcessorTests.java index c0efa4c5e7..359be0dcd9 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/configuration/AutowireBeanFactoryObjectPostProcessorTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/configuration/AutowireBeanFactoryObjectPostProcessorTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.configuration; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.BeanFactoryAware; diff --git a/config/src/test/java/org/springframework/security/config/annotation/issue50/Issue50Tests.java b/config/src/test/java/org/springframework/security/config/annotation/issue50/Issue50Tests.java index 2df6f1aecb..6de1764992 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/issue50/Issue50Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/issue50/Issue50Tests.java @@ -18,10 +18,10 @@ package org.springframework.security.config.annotation.issue50; import javax.transaction.Transactional; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; @@ -35,7 +35,7 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * */ @Transactional -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = { ApplicationConfig.class, SecurityConfig.class }) public class Issue50Tests { @@ -55,13 +55,13 @@ public class Issue50Tests { @Autowired private UserRepository userRepo; - @Before + @BeforeEach public void setup() { SecurityContextHolder.getContext() .setAuthentication(new TestingAuthenticationToken("test", null, "ROLE_ADMIN")); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java index 28bea1da21..0bf6d46113 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java @@ -16,9 +16,9 @@ package org.springframework.security.config.annotation.method.configuration; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -32,7 +32,7 @@ import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.context.ReactiveSecurityContextHolder; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; @@ -44,7 +44,7 @@ import static org.mockito.Mockito.reset; * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration public class EnableReactiveMethodSecurityTests { @@ -61,7 +61,7 @@ public class EnableReactiveMethodSecurityTests { Context withUser = ReactiveSecurityContextHolder .withAuthentication(new TestingAuthenticationToken("user", "password", "ROLE_USER")); - @After + @AfterEach public void cleanup() { reset(this.delegate); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java index 2d6f954a37..d2a4b3ddb0 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java @@ -24,8 +24,8 @@ import javax.sql.DataSource; import org.aopalliance.intercept.MethodInterceptor; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.BeansException; import org.springframework.beans.factory.UnsatisfiedDependencyException; @@ -56,7 +56,7 @@ import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.core.AuthenticationException; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -73,7 +73,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @author Artsiom Yudovin */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class GlobalMethodSecurityConfigurationTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityExpressionHandlerTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityExpressionHandlerTests.java index b9bf7080b8..804ae5cc65 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityExpressionHandlerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityExpressionHandlerTests.java @@ -19,8 +19,8 @@ package org.springframework.security.config.annotation.method.configuration; import java.io.Serializable; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; @@ -31,7 +31,7 @@ import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.core.Authentication; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Rob Winch * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class NamespaceGlobalMethodSecurityExpressionHandlerTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityTests.java index fd46256b4b..cd29a4756d 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityTests.java @@ -24,8 +24,8 @@ import java.util.Collections; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanDefinition; @@ -54,7 +54,7 @@ import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.core.Authentication; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -63,7 +63,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Rob Winch * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class NamespaceGlobalMethodSecurityTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfigurationTests.java index aa967cbe5d..fc8c38e710 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfigurationTests.java @@ -24,8 +24,8 @@ import java.util.List; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.aop.Advisor; import org.springframework.aop.support.DefaultPointcutAdvisor; @@ -54,7 +54,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithAnonymousUser; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -65,7 +65,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Evgeniy Cheban * @author Josh Cummings */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class PrePostMethodSecurityConfigurationTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecurityConfigurationTests.java index f4c7d66b2f..d86d5c3609 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecurityConfigurationTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.method.configuration; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/SampleEnableGlobalMethodSecurityTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/SampleEnableGlobalMethodSecurityTests.java index bf2bf1ae6c..17cba5c812 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/SampleEnableGlobalMethodSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/SampleEnableGlobalMethodSecurityTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.method.configuration; import java.io.Serializable; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -51,7 +51,7 @@ public class SampleEnableGlobalMethodSecurityTests { @Autowired private MethodSecurityService methodSecurityService; - @Before + @BeforeEach public void setup() { SecurityContextHolder.getContext() .setAuthentication(new TestingAuthenticationToken("user", "password", "ROLE_USER")); diff --git a/config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java b/config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java index bd94e55f45..dbdcca266b 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java @@ -19,8 +19,8 @@ package org.springframework.security.config.annotation.sec2758; import javax.annotation.security.RolesAllowed; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; @@ -39,7 +39,7 @@ import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -51,7 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Josh Cummings * */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class Sec2758Tests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/AbstractConfiguredSecurityBuilderTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/AbstractConfiguredSecurityBuilderTests.java index 0409acdfc5..ee59b1aaf5 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/AbstractConfiguredSecurityBuilderTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/AbstractConfiguredSecurityBuilderTests.java @@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.web; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder; import org.springframework.security.config.annotation.ObjectPostProcessor; @@ -41,7 +41,7 @@ public class AbstractConfiguredSecurityBuilderTests { private TestConfiguredSecurityBuilder builder; - @Before + @BeforeEach public void setUp() { this.builder = new TestConfiguredSecurityBuilder(mock(ObjectPostProcessor.class)); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryAnyMatcherTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryAnyMatcherTests.java index 49688e9767..53e50a386d 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryAnyMatcherTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryAnyMatcherTests.java @@ -16,7 +16,7 @@ package org.springframework.security.config.annotation.web; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.mock.web.MockServletContext; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryTests.java index 9e6b57d57c..1b38cac950 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryTests.java @@ -20,8 +20,8 @@ import java.util.List; import javax.servlet.DispatcherType; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @@ -40,7 +40,7 @@ public class AbstractRequestMatcherRegistryTests { private TestRequestMatcherRegistry matcherRegistry; - @Before + @BeforeEach public void setUp() { this.matcherRegistry = new TestRequestMatcherRegistry(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java index 5cb55181c3..39b800955c 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web; import javax.servlet.Filter; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -29,7 +29,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -46,7 +46,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Rob Winch * */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class HttpSecurityHeadersTests { @@ -59,7 +59,7 @@ public class HttpSecurityHeadersTests { MockMvc mockMvc; - @Before + @BeforeEach public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).addFilters(this.springSecurityFilterChain).build(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/SampleWebSecurityConfigurerAdapterTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/SampleWebSecurityConfigurerAdapterTests.java index 8250a819ad..cebc230e1d 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/SampleWebSecurityConfigurerAdapterTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/SampleWebSecurityConfigurerAdapterTests.java @@ -20,9 +20,9 @@ import java.util.Base64; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -64,7 +64,7 @@ public class SampleWebSecurityConfigurerAdapterTests { private MockFilterChain chain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.response = new MockHttpServletResponse(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterMockitoTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterMockitoTests.java index 2125181171..57f17dd6f6 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterMockitoTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterMockitoTests.java @@ -18,14 +18,14 @@ package org.springframework.security.config.annotation.web; import java.util.Arrays; -import org.junit.After; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.support.SpringFactoriesLoader; @@ -55,7 +55,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class WebSecurityConfigurerAdapterMockitoTests { ConfigurableWebApplicationContext context; @@ -69,7 +69,7 @@ public class WebSecurityConfigurerAdapterMockitoTests { @Mock private MockedStatic springFactoriesLoader; - @After + @AfterEach public void close() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterTests.java index f23d730292..2a3068fe07 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterTests.java @@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistrationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistrationTests.java index 2e102a2126..3991a622cf 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistrationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistrationTests.java @@ -24,7 +24,7 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.web.access.channel.ChannelProcessingFilter; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpConfigurationTests.java index 5fa3a802fa..9b15b54134 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpConfigurationTests.java @@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAddFilterTest.java b/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAddFilterTest.java index aeefcdbdc8..d865d1e827 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAddFilterTest.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAddFilterTest.java @@ -28,7 +28,7 @@ import javax.servlet.ServletResponse; import org.assertj.core.api.ListAssert; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Bean; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAuthenticationManagerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAuthenticationManagerTests.java index 47a14e9713..350f9e4275 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAuthenticationManagerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAuthenticationManagerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.builders; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.java index 45478c3a56..6ab844bb0c 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.java @@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDecisionManager; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/builders/WebSecurityTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/builders/WebSecurityTests.java index 8e58db3ec9..275c5d23c9 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/builders/WebSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/builders/WebSecurityTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.builders; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -57,7 +57,7 @@ public class WebSecurityTests { @Autowired FilterChainProxy springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.request.setMethod("GET"); @@ -65,7 +65,7 @@ public class WebSecurityTests { this.chain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/AuthenticationPrincipalArgumentResolverTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/AuthenticationPrincipalArgumentResolverTests.java index a03eb8650b..0899165c92 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/AuthenticationPrincipalArgumentResolverTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/AuthenticationPrincipalArgumentResolverTests.java @@ -16,9 +16,9 @@ package org.springframework.security.config.annotation.web.configuration; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -30,7 +30,7 @@ import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.User; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -47,7 +47,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Rob Winch * */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class AuthenticationPrincipalArgumentResolverTests { @@ -55,7 +55,7 @@ public class AuthenticationPrincipalArgumentResolverTests { @Autowired WebApplicationContext wac; - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/EnableWebSecurityTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/EnableWebSecurityTests.java index 96b058bd50..5acae121b1 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/EnableWebSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/EnableWebSecurityTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configuration; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java index 7d1186c8a0..b64aacb60c 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java @@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest; import com.google.common.net.HttpHeaders; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; 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 122ee95fea..beedd4d5fd 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 @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configuration; import javax.servlet.http.HttpServletRequest; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/Sec2515Tests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/Sec2515Tests.java index 49a354caaa..867c303ddf 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/Sec2515Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/Sec2515Tests.java @@ -20,7 +20,7 @@ import java.net.URL; import java.net.URLClassLoader; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.FatalBeanException; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationResourceServerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationResourceServerTests.java index 0069e02c01..f7ff10f009 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationResourceServerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationResourceServerTests.java @@ -24,7 +24,7 @@ import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; import org.apache.commons.lang.StringUtils; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationTests.java index f7cfa89a12..8227b3f9e3 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationTests.java @@ -23,10 +23,10 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.CoreSubscriber; import reactor.core.publisher.BaseSubscriber; import reactor.core.publisher.Mono; @@ -74,14 +74,14 @@ public class SecurityReactorContextConfigurationTests { @Rule public final SpringTestRule spring = new SpringTestRule(); - @Before + @BeforeEach public void setup() { this.servletRequest = new MockHttpServletRequest(); this.servletResponse = new MockHttpServletResponse(); this.authentication = new TestingAuthenticationToken("principal", "password"); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); RequestContextHolder.resetRequestAttributes(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfigurationTests.java index 09d5c6d44b..9db832d7d9 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfigurationTests.java @@ -16,10 +16,10 @@ package org.springframework.security.config.annotation.web.configuration; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -33,7 +33,7 @@ import org.springframework.security.web.csrf.CsrfToken; import org.springframework.security.web.csrf.DefaultCsrfToken; import org.springframework.stereotype.Controller; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultMatcher; @@ -51,7 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * @author Rob Winch */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class WebMvcSecurityConfigurationTests { @@ -63,7 +63,7 @@ public class WebMvcSecurityConfigurationTests { Authentication authentication; - @Before + @BeforeEach public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build(); this.authentication = new TestingAuthenticationToken("user", "password", @@ -71,7 +71,7 @@ public class WebMvcSecurityConfigurationTests { SecurityContextHolder.getContext().setAuthentication(this.authentication); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java index d877bc222e..2a585885da 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java @@ -26,7 +26,7 @@ import javax.servlet.Filter; import javax.servlet.http.HttpServletRequest; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/sec2377/Sec2377Tests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/sec2377/Sec2377Tests.java index 729c041d08..fab93562e9 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/sec2377/Sec2377Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/sec2377/Sec2377Tests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configuration.sec2377; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.security.config.annotation.web.configuration.sec2377.a.Sec2377AConfig; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistryTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistryTests.java index 39a50575ff..9a33910efe 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistryTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistryTests.java @@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.web.configurers; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.security.access.AccessDecisionVoter; @@ -33,7 +33,7 @@ public class AbstractConfigAttributeRequestMatcherRegistryTests { private ConcreteAbstractRequestMatcherMappingConfigurer registry; - @Before + @BeforeEach public void setup() { this.registry = new ConcreteAbstractRequestMatcherMappingConfigurer(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AnonymousConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AnonymousConfigurerTests.java index c25de5ebaf..59af4b32ab 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AnonymousConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AnonymousConfigurerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java index 42dbea01c6..4d5562509c 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeRequestsTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeRequestsTests.java index 22792f926e..cc8c9dc885 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeRequestsTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeRequestsTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.configurers; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -73,7 +73,7 @@ public class AuthorizeRequestsTests { @Autowired FilterChainProxy springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.servletContext = spy(new MockServletContext()); this.request = new MockHttpServletRequest("GET", ""); @@ -82,7 +82,7 @@ public class AuthorizeRequestsTests { this.chain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ChannelSecurityConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ChannelSecurityConfigurerTests.java index 491c1960ea..339428c00b 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ChannelSecurityConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ChannelSecurityConfigurerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CorsConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CorsConfigurerTests.java index a13bb2af4f..44e2e2fa3d 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CorsConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CorsConfigurerTests.java @@ -21,7 +21,7 @@ import java.util.Collections; import com.google.common.net.HttpHeaders; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerIgnoringRequestMatchersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerIgnoringRequestMatchersTests.java index 7ae673cef3..ed1986d0cf 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerIgnoringRequestMatchersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerIgnoringRequestMatchersTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpMethod; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerNoWebMvcTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerNoWebMvcTests.java index 108f04abb2..3f0cc5a734 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerNoWebMvcTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerNoWebMvcTests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.annotation.web.configurers; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -40,7 +40,7 @@ public class CsrfConfigurerNoWebMvcTests { ConfigurableApplicationContext context; - @After + @AfterEach public void teardown() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerTests.java index a533dd62d8..c4956db9d1 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/CsrfConfigurerTests.java @@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/DefaultFiltersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/DefaultFiltersTests.java index f16d989226..c50ada1258 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/DefaultFiltersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/DefaultFiltersTests.java @@ -24,7 +24,7 @@ import javax.servlet.Filter; import javax.servlet.ServletException; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/DefaultLoginPageConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/DefaultLoginPageConfigurerTests.java index ab373dcaff..7f3c0071e0 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/DefaultLoginPageConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/DefaultLoginPageConfigurerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurerAccessDeniedHandlerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurerAccessDeniedHandlerTests.java index 1022b268e5..bf0f0e76a9 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurerAccessDeniedHandlerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurerAccessDeniedHandlerTests.java @@ -17,8 +17,8 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -32,7 +32,7 @@ import org.springframework.security.web.access.AccessDeniedHandler; import org.springframework.security.web.access.AccessDeniedHandlerImpl; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.AnyRequestMatcher; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -41,7 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class ExceptionHandlingConfigurerAccessDeniedHandlerTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurerTests.java index 8837354084..532ee806fe 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurerTests.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurerTests.java index 6ee24188f8..9b38a54035 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurerTests.java @@ -20,7 +20,7 @@ import java.io.Serializable; import java.util.Collections; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java index 80261676f0..765d1d5ff3 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HeadersConfigurerEagerHeadersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HeadersConfigurerEagerHeadersTests.java index 86163e04c8..5ec76b888c 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HeadersConfigurerEagerHeadersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HeadersConfigurerEagerHeadersTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HeadersConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HeadersConfigurerTests.java index dffe4390e5..3b964f3e74 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HeadersConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HeadersConfigurerTests.java @@ -22,7 +22,7 @@ import java.util.Map; import com.google.common.net.HttpHeaders; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpBasicConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpBasicConfigurerTests.java index 8d8f686510..9c7790fb53 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpBasicConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpBasicConfigurerTests.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityAntMatchersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityAntMatchersTests.java index 9690aed1dd..73d366be00 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityAntMatchersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityAntMatchersTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.configurers; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -54,14 +54,14 @@ public class HttpSecurityAntMatchersTests { @Autowired FilterChainProxy springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.response = new MockHttpServletResponse(); this.chain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java index da18813b49..f4d4c5db0b 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java @@ -16,9 +16,9 @@ package org.springframework.security.config.annotation.web.configurers; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -55,14 +55,14 @@ public class HttpSecurityLogoutTests { @Autowired FilterChainProxy springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.response = new MockHttpServletResponse(); this.chain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityRequestMatchersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityRequestMatchersTests.java index ca4ae5ff5b..9e60e93994 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityRequestMatchersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityRequestMatchersTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.configurers; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -60,7 +60,7 @@ public class HttpSecurityRequestMatchersTests { @Autowired FilterChainProxy springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.request.setMethod("GET"); @@ -68,7 +68,7 @@ public class HttpSecurityRequestMatchersTests { this.chain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/Issue55Tests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/Issue55Tests.java index bb9e239a48..14439bf70a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/Issue55Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/Issue55Tests.java @@ -22,7 +22,7 @@ import java.util.List; import javax.servlet.Filter; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/JeeConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/JeeConfigurerTests.java index 2562ede8a8..a72af22f92 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/JeeConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/JeeConfigurerTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configurers; import java.security.Principal; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurerClearSiteDataTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurerClearSiteDataTests.java index 0587442d9f..4f7cee656f 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurerClearSiteDataTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurerClearSiteDataTests.java @@ -17,8 +17,8 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -30,7 +30,7 @@ import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.authentication.logout.HeaderWriterLogoutHandler; import org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter; import org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter.Directive; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; @@ -47,7 +47,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Rafiullah Hamedy * */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class LogoutConfigurerClearSiteDataTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurerTests.java index 610005145d..4f4ed19da0 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.apache.http.HttpHeaders; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceDebugTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceDebugTests.java index 4401d80f0b..99583031e5 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceDebugTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceDebugTests.java @@ -21,7 +21,7 @@ import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.Appender; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpAnonymousTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpAnonymousTests.java index 6ebf4a23dd..8ada5b980c 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpAnonymousTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpAnonymousTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configurers; import java.util.Optional; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AnonymousAuthenticationToken; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpBasicTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpBasicTests.java index ac85f2b260..386eb4954e 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpBasicTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpBasicTests.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; import org.apache.http.HttpHeaders; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpCustomFilterTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpCustomFilterTests.java index f3623fd1a0..d01220503a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpCustomFilterTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpCustomFilterTests.java @@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletResponse; import org.assertj.core.api.ListAssert; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpExpressionHandlerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpExpressionHandlerTests.java index 8255188f71..a5a2d0f69b 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpExpressionHandlerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpExpressionHandlerTests.java @@ -19,8 +19,8 @@ package org.springframework.security.config.annotation.web.configurers; import java.security.Principal; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -34,7 +34,7 @@ import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -53,7 +53,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Josh Cummings * */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class NamespaceHttpExpressionHandlerTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpFirewallTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpFirewallTests.java index 61b7b91598..7a45fee6b1 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpFirewallTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpFirewallTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configurers; import javax.servlet.http.HttpServletRequest; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpFormLoginTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpFormLoginTests.java index af53890e84..1494cd72aa 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpFormLoginTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpFormLoginTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configurers; import javax.servlet.http.HttpServletRequest; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpHeadersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpHeadersTests.java index c9f11e767f..70b51cbf81 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpHeadersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpHeadersTests.java @@ -22,7 +22,7 @@ import java.util.LinkedHashMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpInterceptUrlTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpInterceptUrlTests.java index b52eee3ec4..607cda3d0f 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpInterceptUrlTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpInterceptUrlTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpMethod; @@ -109,27 +109,24 @@ public class NamespaceHttpInterceptUrlTests { protected void configure(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests() + .authorizeRequests().antMatchers( // the line below is similar to intercept-url@pattern: // - // - .antMatchers("/users**", "/sessions/**").hasRole("ADMIN") + //" access="hasRole('ROLE_ADMIN')"/> +"/users**", "/sessions/**").hasRole("ADMIN").antMatchers( // the line below is similar to intercept-url@method: // - // - .antMatchers(HttpMethod.POST, "/admin/post", "/admin/another-post/**").hasRole("ADMIN") + //" access="hasRole('ROLE_ADMIN')" method="POST"/> +HttpMethod.POST, "/admin/post", "/admin/another-post/**").hasRole("ADMIN") .antMatchers("/signup").permitAll() .anyRequest().hasRole("USER") .and() - .requiresChannel() + .requiresChannel().antMatchers( // NOTE: channel security is configured separately of authorization (i.e. intercept-url@access // the line below is similar to intercept-url@requires-channel="https": // - // - .antMatchers("/login", "/secured/**").requiresSecure() - // the line below is similar to intercept-url@requires-channel="http": - // - .anyRequest().requiresInsecure(); + //" requires-channel="https"/> +"/login", "/secured/**").requiresSecure().anyRequest()..requiresInsecure(); // @formatter:on } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpJeeTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpJeeTests.java index f83e15ba4a..3c94227c89 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpJeeTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpJeeTests.java @@ -20,7 +20,7 @@ import java.security.Principal; import java.util.stream.Collectors; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpLogoutTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpLogoutTests.java index 5b02de5f44..22cb8b5eae 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpLogoutTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpLogoutTests.java @@ -24,8 +24,8 @@ import javax.servlet.http.HttpSession; import org.assertj.core.api.Condition; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -37,7 +37,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultMatcher; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; @@ -56,7 +56,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Rob Winch * @author Josh Cummings */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class NamespaceHttpLogoutTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpOpenIDLoginTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpOpenIDLoginTests.java index 273a528aef..8ead771d97 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpOpenIDLoginTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpOpenIDLoginTests.java @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openid4java.consumer.ConsumerManager; import org.openid4java.discovery.DiscoveryInformation; import org.openid4java.discovery.yadis.YadisResolver; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpPortMappingsTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpPortMappingsTests.java index 011409d9fb..7fb86e2210 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpPortMappingsTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpPortMappingsTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpRequestCacheTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpRequestCacheTests.java index be604a4b8a..8c22dfc093 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpRequestCacheTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpRequestCacheTests.java @@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpServerAccessDeniedHandlerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpServerAccessDeniedHandlerTests.java index 844058f8f4..4214d99e46 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpServerAccessDeniedHandlerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpServerAccessDeniedHandlerTests.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java index 06df9f2e0f..c637009852 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java @@ -24,7 +24,7 @@ import java.security.cert.X509Certificate; import javax.servlet.http.HttpServletRequest; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import sun.security.x509.X500Name; import org.springframework.beans.factory.annotation.Autowired; 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 b3598dfca4..f5c140d3e4 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 @@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceSessionManagementTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceSessionManagementTests.java index 8c43518461..c6d05c1b93 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceSessionManagementTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceSessionManagementTests.java @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PasswordManagementConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PasswordManagementConfigurerTests.java index 23eae5a8da..02610d174a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PasswordManagementConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PasswordManagementConfigurerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java index 35d1573329..77264aa038 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PortMapperConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PortMapperConfigurerTests.java index bf21abbd7c..baf4f98793 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PortMapperConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PortMapperConfigurerTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configurers; import java.util.Collections; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RememberMeConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RememberMeConfigurerTests.java index 93946ab099..37b3899eb0 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RememberMeConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RememberMeConfigurerTests.java @@ -22,7 +22,7 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpSession; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java index effda94173..c93ac4a7ee 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestMatcherConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestMatcherConfigurerTests.java index c5c6196869..a7bde3773e 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestMatcherConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestMatcherConfigurerTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SecurityContextConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SecurityContextConfigurerTests.java index fc99c2772d..3ec3a31f96 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SecurityContextConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SecurityContextConfigurerTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configurers; import javax.servlet.http.HttpSession; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java index 8b511b841a..0bc1db8600 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerServlet31Tests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerServlet31Tests.java index af565d7ba3..e833999f1a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerServlet31Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerServlet31Tests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.configurers; import javax.servlet.Filter; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -56,14 +56,14 @@ public class SessionManagementConfigurerServlet31Tests { Filter springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.response = new MockHttpServletResponse(); this.chain = new MockFilterChain(); } - @After + @AfterEach public void teardown() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerSessionAuthenticationStrategyTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerSessionAuthenticationStrategyTests.java index 8985070277..0a9d693b14 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerSessionAuthenticationStrategyTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerSessionAuthenticationStrategyTests.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerSessionCreationPolicyTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerSessionCreationPolicyTests.java index 562e344784..d26a2b3764 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerSessionCreationPolicyTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerSessionCreationPolicyTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerTests.java index 638391dd6e..1a046d7cb3 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerTests.java @@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerTransientAuthenticationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerTransientAuthenticationTests.java index c5b5dd2cc5..829dbe0720 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerTransientAuthenticationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurerTransientAuthenticationTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.configurers; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AbstractAuthenticationToken; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationConfigurerTests.java index 34dcb0f52d..914ea135ea 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationConfigurerTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.configurers; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -60,7 +60,7 @@ public class UrlAuthorizationConfigurerTests { @Autowired FilterChainProxy springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.request.setMethod("GET"); @@ -68,7 +68,7 @@ public class UrlAuthorizationConfigurerTests { this.chain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationsTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationsTests.java index 90620c97fe..38cbb55c9d 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationsTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationsTests.java @@ -21,8 +21,8 @@ import java.util.List; import javax.servlet.Filter; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -35,7 +35,7 @@ import org.springframework.security.test.context.annotation.SecurityTestExecutio import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import static org.assertj.core.api.Assertions.assertThat; @@ -47,7 +47,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Josh Cummings * */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class UrlAuthorizationsTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/X509ConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/X509ConfigurerTests.java index e7ef36d356..c89418e343 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/X509ConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/X509ConfigurerTests.java @@ -22,7 +22,7 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2ClientConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2ClientConfigurerTests.java index 1af41324b6..7c4dc51ac8 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2ClientConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2ClientConfigurerTests.java @@ -22,9 +22,9 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -106,7 +106,7 @@ public class OAuth2ClientConfigurerTests { private ClientRegistration registration1; - @Before + @BeforeEach public void setup() { // @formatter:off this.registration1 = TestClientRegistrations.clientRegistration() diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java index 9fac94fae1..9410b004d4 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java @@ -24,10 +24,10 @@ import java.util.List; import java.util.Map; import org.apache.http.HttpHeaders; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.NoUniqueBeanDefinitionException; @@ -157,7 +157,7 @@ public class OAuth2LoginConfigurerTests { private MockFilterChain filterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.request.setServletPath("/login/oauth2/code/google"); @@ -165,7 +165,7 @@ public class OAuth2LoginConfigurerTests { this.filterChain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java index 2b8e7a727a..a8decc13ef 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java @@ -50,7 +50,7 @@ import org.hamcrest.core.StringContains; import org.hamcrest.core.StringEndsWith; import org.hamcrest.core.StringStartsWith; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.NoUniqueBeanDefinitionException; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurerTests.java index 420e8e1a0b..0582e0f7c2 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurerTests.java @@ -21,7 +21,7 @@ import java.util.List; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openid4java.consumer.ConsumerManager; import org.openid4java.discovery.DiscoveryInformation; import org.openid4java.discovery.yadis.YadisResolver; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java index c191b5dff7..276517839f 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java @@ -28,11 +28,11 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.opensaml.saml.saml2.core.Assertion; import org.opensaml.saml.saml2.core.AuthnRequest; @@ -141,7 +141,7 @@ public class Saml2LoginConfigurerTests { private MockFilterChain filterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("POST", ""); this.request.setServletPath("/login/saml2/sso/test-rp"); @@ -149,7 +149,7 @@ public class Saml2LoginConfigurerTests { this.filterChain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); @@ -261,7 +261,7 @@ public class Saml2LoginConfigurerTests { // assertions Authentication authentication = this.securityContextRepository .loadContext(new HttpRequestResponseHolder(this.request, this.response)).getAuthentication(); - Assert.assertNotNull("Expected a valid authentication object.", authentication); + Assertions.assertNotNull(authentication, "Expected a valid authentication object."); assertThat(authentication.getAuthorities()).hasSize(1); assertThat(authentication.getAuthorities()).first().isInstanceOf(SimpleGrantedAuthority.class) .hasToString(expected); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/messaging/MessageSecurityMetadataSourceRegistryTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/messaging/MessageSecurityMetadataSourceRegistryTests.java index c6edb4b5d2..7070547813 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/messaging/MessageSecurityMetadataSourceRegistryTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/messaging/MessageSecurityMetadataSourceRegistryTests.java @@ -18,11 +18,11 @@ package org.springframework.security.config.annotation.web.messaging; import java.util.Collection; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.messaging.Message; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MessageSecurityMetadataSourceRegistryTests { @Mock @@ -47,7 +47,7 @@ public class MessageSecurityMetadataSourceRegistryTests { private Message message; - @Before + @BeforeEach public void setup() { this.messages = new MessageSecurityMetadataSourceRegistry(); // @formatter:off diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/reactive/EnableWebFluxSecurityTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/reactive/EnableWebFluxSecurityTests.java index fdee0ecb98..84dc407978 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/reactive/EnableWebFluxSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/reactive/EnableWebFluxSecurityTests.java @@ -19,8 +19,8 @@ package org.springframework.security.config.annotation.web.reactive; import java.nio.charset.StandardCharsets; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; @@ -57,7 +57,7 @@ import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.security.web.server.WebFilterChainProxy; import org.springframework.security.web.server.context.WebSessionServerSecurityContextRepository; import org.springframework.security.web.server.util.matcher.PathPatternParserServerWebExchangeMatcher; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.reactive.server.FluxExchangeResult; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.util.LinkedMultiValueMap; @@ -77,7 +77,7 @@ import static org.springframework.security.test.web.reactive.server.SecurityMock * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class EnableWebFluxSecurityTests { diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/reactive/ServerHttpSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/reactive/ServerHttpSecurityConfigurationTests.java index b791eba328..cb9a824fdf 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/reactive/ServerHttpSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/reactive/ServerHttpSecurityConfigurationTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.reactive; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.test.SpringTestRule; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfigurationTests.java index 43fb7fb1da..226520cdc0 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfigurationTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.annotation.web.reactive; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.test.SpringTestRule; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurerDocTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurerDocTests.java index 60d86e7ec9..adbfd09e76 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurerDocTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurerDocTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.socket; import java.util.HashMap; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -57,14 +57,14 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerDocTests { String sessionAttr; - @Before + @BeforeEach public void setup() { this.token = new DefaultCsrfToken("header", "param", "token"); this.sessionAttr = "sessionAttr"; this.messageUser = new TestingAuthenticationToken("user", "pass", "ROLE_USER"); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurerTests.java index 98cd855d53..8d0ad84835 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurerTests.java @@ -21,9 +21,9 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -90,14 +90,14 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests { String sessionAttr; - @Before + @BeforeEach public void setup() { this.token = new DefaultCsrfToken("header", "param", "token"); this.sessionAttr = "sessionAttr"; this.messageUser = new TestingAuthenticationToken("user", "pass", "ROLE_USER"); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationConfigurationGh3935Tests.java b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationConfigurationGh3935Tests.java index bdc4383017..6d5c0d50d7 100644 --- a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationConfigurationGh3935Tests.java +++ b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationConfigurationGh3935Tests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.authentication; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -35,7 +35,7 @@ import org.springframework.security.core.userdetails.PasswordEncodedUser; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.web.FilterChainProxy; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; @@ -45,7 +45,7 @@ import static org.mockito.Mockito.verify; /** * @author Rob Winch */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration public class AuthenticationConfigurationGh3935Tests { diff --git a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParserTests.java index c71f7917a0..8301e1bf57 100644 --- a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParserTests.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.List; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; diff --git a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java index fd4fc1f762..b32069216d 100644 --- a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java @@ -18,8 +18,8 @@ package org.springframework.security.config.authentication; import java.util.List; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; import org.springframework.context.support.AbstractXmlApplicationContext; @@ -44,7 +44,7 @@ public class AuthenticationProviderBeanDefinitionParserTests { private UsernamePasswordAuthenticationToken bob = new UsernamePasswordAuthenticationToken("bob", "bobspassword"); - @After + @AfterEach public void closeAppContext() { if (this.appContext != null) { this.appContext.close(); diff --git a/config/src/test/java/org/springframework/security/config/authentication/JdbcUserServiceBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/authentication/JdbcUserServiceBeanDefinitionParserTests.java index a8cd7ceb0b..75ae43bebf 100644 --- a/config/src/test/java/org/springframework/security/config/authentication/JdbcUserServiceBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/authentication/JdbcUserServiceBeanDefinitionParserTests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.authentication; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.w3c.dom.Element; import org.springframework.security.authentication.AuthenticationManager; @@ -55,7 +55,7 @@ public class JdbcUserServiceBeanDefinitionParserTests { private InMemoryXmlApplicationContext appContext; - @After + @AfterEach public void closeAppContext() { if (this.appContext != null) { this.appContext.close(); diff --git a/config/src/test/java/org/springframework/security/config/authentication/PasswordEncoderParserTests.java b/config/src/test/java/org/springframework/security/config/authentication/PasswordEncoderParserTests.java index 3a5be4981d..cfb70c3f02 100644 --- a/config/src/test/java/org/springframework/security/config/authentication/PasswordEncoderParserTests.java +++ b/config/src/test/java/org/springframework/security/config/authentication/PasswordEncoderParserTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.authentication; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.test.SpringTestRule; diff --git a/config/src/test/java/org/springframework/security/config/authentication/UserServiceBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/authentication/UserServiceBeanDefinitionParserTests.java index b5d636f892..3240058897 100644 --- a/config/src/test/java/org/springframework/security/config/authentication/UserServiceBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/authentication/UserServiceBeanDefinitionParserTests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.authentication; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.FatalBeanException; import org.springframework.context.support.AbstractXmlApplicationContext; @@ -35,7 +35,7 @@ public class UserServiceBeanDefinitionParserTests { private AbstractXmlApplicationContext appContext; - @After + @AfterEach public void closeAppContext() { if (this.appContext != null) { this.appContext.close(); diff --git a/config/src/test/java/org/springframework/security/config/core/GrantedAuthorityDefaultsJcTests.java b/config/src/test/java/org/springframework/security/config/core/GrantedAuthorityDefaultsJcTests.java index 3ffa7eec71..e90098d447 100644 --- a/config/src/test/java/org/springframework/security/config/core/GrantedAuthorityDefaultsJcTests.java +++ b/config/src/test/java/org/springframework/security/config/core/GrantedAuthorityDefaultsJcTests.java @@ -24,10 +24,10 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -47,12 +47,12 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.context.HttpSessionSecurityContextRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration public class GrantedAuthorityDefaultsJcTests { @@ -68,7 +68,7 @@ public class GrantedAuthorityDefaultsJcTests { MockFilterChain chain; - @Before + @BeforeEach public void setup() { setup("USER"); this.request = new MockHttpServletRequest("GET", ""); @@ -77,7 +77,7 @@ public class GrantedAuthorityDefaultsJcTests { this.chain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/core/GrantedAuthorityDefaultsXmlTests.java b/config/src/test/java/org/springframework/security/config/core/GrantedAuthorityDefaultsXmlTests.java index bcd36eff3d..8fb04ed1d5 100644 --- a/config/src/test/java/org/springframework/security/config/core/GrantedAuthorityDefaultsXmlTests.java +++ b/config/src/test/java/org/springframework/security/config/core/GrantedAuthorityDefaultsXmlTests.java @@ -24,10 +24,10 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockFilterChain; @@ -40,12 +40,12 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.context.HttpSessionSecurityContextRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration public class GrantedAuthorityDefaultsXmlTests { @@ -61,7 +61,7 @@ public class GrantedAuthorityDefaultsXmlTests { MockFilterChain chain; - @Before + @BeforeEach public void setup() { setup("USER"); this.request = new MockHttpServletRequest("GET", ""); @@ -70,7 +70,7 @@ public class GrantedAuthorityDefaultsXmlTests { this.chain = new MockFilterChain(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceITests.java b/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceITests.java index 77bbef169f..cdf9dd7023 100644 --- a/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceITests.java +++ b/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceITests.java @@ -16,15 +16,15 @@ package org.springframework.security.config.core.userdetails; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.core.userdetails.ReactiveUserDetailsService; import org.springframework.security.util.InMemoryResource; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceITests { @Autowired diff --git a/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceLocationITests.java b/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceLocationITests.java index cd720f1b7b..60b0836186 100644 --- a/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceLocationITests.java +++ b/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceLocationITests.java @@ -16,14 +16,14 @@ package org.springframework.security.config.core.userdetails; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.core.userdetails.ReactiveUserDetailsService; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class ReactiveUserDetailsServiceResourceFactoryBeanPropertiesResourceLocationITests { @Autowired diff --git a/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanStringITests.java b/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanStringITests.java index f257138526..4b08569879 100644 --- a/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanStringITests.java +++ b/config/src/test/java/org/springframework/security/config/core/userdetails/ReactiveUserDetailsServiceResourceFactoryBeanStringITests.java @@ -16,14 +16,14 @@ package org.springframework.security.config.core.userdetails; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.core.userdetails.ReactiveUserDetailsService; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class ReactiveUserDetailsServiceResourceFactoryBeanStringITests { @Autowired diff --git a/config/src/test/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBeanTests.java b/config/src/test/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBeanTests.java index 03ceae7ded..c4a4cd225b 100644 --- a/config/src/test/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBeanTests.java +++ b/config/src/test/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBeanTests.java @@ -18,10 +18,10 @@ package org.springframework.security.config.core.userdetails; import java.util.Collection; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.io.ResourceLoader; import org.springframework.security.core.userdetails.User; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class UserDetailsResourceFactoryBeanTests { @Mock diff --git a/config/src/test/java/org/springframework/security/config/crypto/RsaKeyConversionServicePostProcessorTests.java b/config/src/test/java/org/springframework/security/config/crypto/RsaKeyConversionServicePostProcessorTests.java index 84709eea8b..502a407387 100644 --- a/config/src/test/java/org/springframework/security/config/crypto/RsaKeyConversionServicePostProcessorTests.java +++ b/config/src/test/java/org/springframework/security/config/crypto/RsaKeyConversionServicePostProcessorTests.java @@ -19,9 +19,9 @@ package org.springframework.security.config.crypto; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; @@ -94,7 +94,7 @@ public class RsaKeyConversionServicePostProcessorTests { @Rule public final SpringTestRule spring = new SpringTestRule(); - @Before + @BeforeEach public void setUp() { ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory(); beanFactory.setConversionService(new GenericConversionService()); diff --git a/config/src/test/java/org/springframework/security/config/debug/SecurityDebugBeanFactoryPostProcessorTests.java b/config/src/test/java/org/springframework/security/config/debug/SecurityDebugBeanFactoryPostProcessorTests.java index 4d885e2116..f82641e045 100644 --- a/config/src/test/java/org/springframework/security/config/debug/SecurityDebugBeanFactoryPostProcessorTests.java +++ b/config/src/test/java/org/springframework/security/config/debug/SecurityDebugBeanFactoryPostProcessorTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.debug; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.config.BeanIds; import org.springframework.security.config.test.SpringTestRule; diff --git a/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java b/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java index d5e01a03d4..57a0aaac61 100644 --- a/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java +++ b/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java @@ -30,8 +30,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.lang.StringUtils; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.security.config.http.SecurityFiltersAssertions; @@ -68,7 +68,7 @@ public class XsdDocumentedTests { XmlSupport xml = new XmlSupport(); - @After + @AfterEach public void close() throws IOException { this.xml.close(); } diff --git a/config/src/test/java/org/springframework/security/config/http/AccessDeniedConfigTests.java b/config/src/test/java/org/springframework/security/config/http/AccessDeniedConfigTests.java index 1344c1b3a5..4cfb4bf200 100644 --- a/config/src/test/java/org/springframework/security/config/http/AccessDeniedConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/AccessDeniedConfigTests.java @@ -21,8 +21,8 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpStatus; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +33,7 @@ import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.access.AccessDeniedHandler; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -44,7 +44,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Luke Taylor * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class AccessDeniedConfigTests { diff --git a/config/src/test/java/org/springframework/security/config/http/CsrfBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/CsrfBeanDefinitionParserTests.java index d8e9862560..f1e5521be2 100644 --- a/config/src/test/java/org/springframework/security/config/http/CsrfBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/CsrfBeanDefinitionParserTests.java @@ -16,7 +16,7 @@ package org.springframework.security.config.http; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/config/src/test/java/org/springframework/security/config/http/CsrfConfigTests.java b/config/src/test/java/org/springframework/security/config/http/CsrfConfigTests.java index 7f4894f161..a540cbd7a3 100644 --- a/config/src/test/java/org/springframework/security/config/http/CsrfConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/CsrfConfigTests.java @@ -25,8 +25,8 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpStatus; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpMethod; @@ -44,7 +44,7 @@ import org.springframework.security.web.csrf.CsrfFilter; import org.springframework.security.web.csrf.CsrfToken; import org.springframework.security.web.util.matcher.RequestMatcher; import org.springframework.stereotype.Controller; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.ResultMatcher; @@ -76,7 +76,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Rob Winch * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class CsrfConfigTests { 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 61895a4994..7b2ede4484 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 @@ -19,11 +19,11 @@ package org.springframework.security.config.http; import java.util.Collection; import org.apache.commons.logging.Log; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.access.AccessDecisionManager; import org.springframework.security.core.Authentication; @@ -48,7 +48,7 @@ import static org.mockito.Mockito.verify; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DefaultFilterChainValidatorTests { private DefaultFilterChainValidator validator; @@ -66,7 +66,7 @@ public class DefaultFilterChainValidatorTests { private FilterSecurityInterceptor fsi; - @Before + @BeforeEach public void setUp() { AnonymousAuthenticationFilter aaf = new AnonymousAuthenticationFilter("anonymous"); this.fsi = new FilterSecurityInterceptor(); diff --git a/config/src/test/java/org/springframework/security/config/http/FilterSecurityMetadataSourceBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/FilterSecurityMetadataSourceBeanDefinitionParserTests.java index e65f92cd59..bdf66edd91 100644 --- a/config/src/test/java/org/springframework/security/config/http/FilterSecurityMetadataSourceBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/FilterSecurityMetadataSourceBeanDefinitionParserTests.java @@ -18,8 +18,8 @@ package org.springframework.security.config.http; import java.util.Collection; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; import org.springframework.context.support.AbstractXmlApplicationContext; @@ -47,7 +47,7 @@ public class FilterSecurityMetadataSourceBeanDefinitionParserTests { private AbstractXmlApplicationContext appContext; - @After + @AfterEach public void closeAppContext() { if (this.appContext != null) { this.appContext.close(); diff --git a/config/src/test/java/org/springframework/security/config/http/FormLoginBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/FormLoginBeanDefinitionParserTests.java index 27bffb53d1..d95f5c9b7f 100644 --- a/config/src/test/java/org/springframework/security/config/http/FormLoginBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/FormLoginBeanDefinitionParserTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.http; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.test.SpringTestRule; diff --git a/config/src/test/java/org/springframework/security/config/http/FormLoginConfigTests.java b/config/src/test/java/org/springframework/security/config/http/FormLoginConfigTests.java index ca04337f27..082e453b86 100644 --- a/config/src/test/java/org/springframework/security/config/http/FormLoginConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/FormLoginConfigTests.java @@ -23,7 +23,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/http/HttpConfigTests.java b/config/src/test/java/org/springframework/security/config/http/HttpConfigTests.java index 5174dc331c..6df9d0f3e4 100644 --- a/config/src/test/java/org/springframework/security/config/http/HttpConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/HttpConfigTests.java @@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletResponseWrapper; import org.apache.http.HttpStatus; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/config/src/test/java/org/springframework/security/config/http/HttpCorsConfigTests.java b/config/src/test/java/org/springframework/security/config/http/HttpCorsConfigTests.java index c1ad5415d1..ea6eeb3419 100644 --- a/config/src/test/java/org/springframework/security/config/http/HttpCorsConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/HttpCorsConfigTests.java @@ -19,7 +19,7 @@ package org.springframework.security.config.http; import java.util.Arrays; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/http/HttpHeadersConfigTests.java b/config/src/test/java/org/springframework/security/config/http/HttpHeadersConfigTests.java index 59dda6b7b0..2a96348002 100644 --- a/config/src/test/java/org/springframework/security/config/http/HttpHeadersConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/HttpHeadersConfigTests.java @@ -25,7 +25,7 @@ import java.util.Set; import com.google.common.collect.ImmutableMap; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java b/config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java index 2f226a45b5..462fa5dd38 100644 --- a/config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java +++ b/config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java @@ -18,8 +18,8 @@ package org.springframework.security.config.http; import javax.servlet.Filter; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockServletContext; import org.springframework.test.web.servlet.MockMvc; @@ -38,7 +38,7 @@ public class HttpInterceptUrlTests { MockMvc mockMvc; - @After + @AfterEach public void close() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/http/InterceptUrlConfigTests.java b/config/src/test/java/org/springframework/security/config/http/InterceptUrlConfigTests.java index ec068463d2..f0ea00ab69 100644 --- a/config/src/test/java/org/springframework/security/config/http/InterceptUrlConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/InterceptUrlConfigTests.java @@ -22,7 +22,7 @@ import java.util.Map; import javax.servlet.ServletRegistration; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java b/config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java index cd87b93ac6..8bc3d73c5b 100644 --- a/config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java @@ -45,7 +45,7 @@ import org.apache.http.HttpStatus; import org.assertj.core.api.iterable.Extractor; import org.jetbrains.annotations.NotNull; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.slf4j.LoggerFactory; diff --git a/config/src/test/java/org/springframework/security/config/http/MultiHttpBlockConfigTests.java b/config/src/test/java/org/springframework/security/config/http/MultiHttpBlockConfigTests.java index 38d42bd9b1..d3a25bd963 100644 --- a/config/src/test/java/org/springframework/security/config/http/MultiHttpBlockConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/MultiHttpBlockConfigTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.http; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/http/NamespaceHttpBasicTests.java b/config/src/test/java/org/springframework/security/config/http/NamespaceHttpBasicTests.java index 03f54cd561..1616a8b6c7 100644 --- a/config/src/test/java/org/springframework/security/config/http/NamespaceHttpBasicTests.java +++ b/config/src/test/java/org/springframework/security/config/http/NamespaceHttpBasicTests.java @@ -22,9 +22,9 @@ import java.util.Base64; import javax.servlet.Filter; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.springframework.context.ConfigurableApplicationContext; @@ -53,7 +53,7 @@ public class NamespaceHttpBasicTests { Filter springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.request.setMethod("GET"); @@ -61,7 +61,7 @@ public class NamespaceHttpBasicTests { this.chain = new MockFilterChain(); } - @After + @AfterEach public void teardown() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/http/OAuth2ClientBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/OAuth2ClientBeanDefinitionParserTests.java index 085ec83e68..5411f39f12 100644 --- a/config/src/test/java/org/springframework/security/config/http/OAuth2ClientBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/OAuth2ClientBeanDefinitionParserTests.java @@ -20,8 +20,8 @@ import java.util.HashMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; @@ -44,7 +44,7 @@ import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; import org.springframework.security.oauth2.core.endpoint.TestOAuth2AccessTokenResponses; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.ui.Model; @@ -67,7 +67,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * * @author Joe Grandja */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class OAuth2ClientBeanDefinitionParserTests { diff --git a/config/src/test/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests.java index 123f7d9093..b50b2d9cd1 100644 --- a/config/src/test/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests.java @@ -21,8 +21,8 @@ import java.util.HashMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; @@ -66,7 +66,7 @@ import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.security.web.savedrequest.RequestCache; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.ui.Model; @@ -90,7 +90,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * * @author Ruby Hartono */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class OAuth2LoginBeanDefinitionParserTests { diff --git a/config/src/test/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java index d0529ae17d..c524a2b889 100644 --- a/config/src/test/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java @@ -47,8 +47,8 @@ import org.hamcrest.core.StringContains; import org.hamcrest.core.StringEndsWith; import org.hamcrest.core.StringStartsWith; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; import org.w3c.dom.Element; @@ -88,7 +88,7 @@ import org.springframework.security.oauth2.server.resource.introspection.NimbusO import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector; import org.springframework.security.oauth2.server.resource.web.BearerTokenResolver; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.ResultMatcher; @@ -119,7 +119,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class OAuth2ResourceServerBeanDefinitionParserTests { diff --git a/config/src/test/java/org/springframework/security/config/http/OpenIDConfigTests.java b/config/src/test/java/org/springframework/security/config/http/OpenIDConfigTests.java index 5d2c13657d..e48aec52ec 100644 --- a/config/src/test/java/org/springframework/security/config/http/OpenIDConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/OpenIDConfigTests.java @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletRequest; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openid4java.consumer.ConsumerManager; import org.openid4java.discovery.yadis.YadisResolver; diff --git a/config/src/test/java/org/springframework/security/config/http/PlaceHolderAndELConfigTests.java b/config/src/test/java/org/springframework/security/config/http/PlaceHolderAndELConfigTests.java index 10d289d8e4..b6c001abd3 100644 --- a/config/src/test/java/org/springframework/security/config/http/PlaceHolderAndELConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/PlaceHolderAndELConfigTests.java @@ -17,14 +17,14 @@ package org.springframework.security.config.http; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -38,7 +38,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class PlaceHolderAndELConfigTests { diff --git a/config/src/test/java/org/springframework/security/config/http/RememberMeConfigTests.java b/config/src/test/java/org/springframework/security/config/http/RememberMeConfigTests.java index 2774114e6d..fc13637022 100644 --- a/config/src/test/java/org/springframework/security/config/http/RememberMeConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/RememberMeConfigTests.java @@ -21,7 +21,7 @@ import java.util.Collections; import javax.servlet.http.Cookie; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.FatalBeanException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/config/src/test/java/org/springframework/security/config/http/SecurityContextHolderAwareRequestConfigTests.java b/config/src/test/java/org/springframework/security/config/http/SecurityContextHolderAwareRequestConfigTests.java index 0399d25cd1..2f38bd9a4c 100644 --- a/config/src/test/java/org/springframework/security/config/http/SecurityContextHolderAwareRequestConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/SecurityContextHolderAwareRequestConfigTests.java @@ -24,8 +24,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.http.HttpHeaders; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockHttpSession; @@ -33,7 +33,7 @@ import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.web.bind.annotation.GetMapping; @@ -52,7 +52,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Rob Winch * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class SecurityContextHolderAwareRequestConfigTests { diff --git a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigServlet31Tests.java b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigServlet31Tests.java index 5be74bcab5..c21f42b985 100644 --- a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigServlet31Tests.java +++ b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigServlet31Tests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.http; import javax.servlet.Filter; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.mock.web.MockFilterChain; @@ -60,14 +60,14 @@ public class SessionManagementConfigServlet31Tests { Filter springSecurityFilterChain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.response = new MockHttpServletResponse(); this.chain = new MockFilterChain(); } - @After + @AfterEach public void teardown() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTests.java b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTests.java index d2c31432e4..93f46e8c09 100644 --- a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTests.java @@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponseWrapper; import org.apache.http.HttpStatus; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; diff --git a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTransientAuthenticationTests.java b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTransientAuthenticationTests.java index 8e2df3e6e9..be42006062 100644 --- a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTransientAuthenticationTests.java +++ b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTransientAuthenticationTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.http; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AbstractAuthenticationToken; 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 0199cbbb4f..3682195fde 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 @@ -16,16 +16,16 @@ package org.springframework.security.config.http; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.xml.ParserContext; import static org.mockito.Mockito.verifyZeroInteractions; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class WebConfigUtilsTests { public static final String URL = "/url"; diff --git a/config/src/test/java/org/springframework/security/config/http/WellKnownChangePasswordBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/WellKnownChangePasswordBeanDefinitionParserTests.java index 25772e847e..2ba8842a57 100644 --- a/config/src/test/java/org/springframework/security/config/http/WellKnownChangePasswordBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/WellKnownChangePasswordBeanDefinitionParserTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.http; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.test.SpringTestRule; diff --git a/config/src/test/java/org/springframework/security/config/http/customconfigurer/CustomHttpSecurityConfigurerTests.java b/config/src/test/java/org/springframework/security/config/http/customconfigurer/CustomHttpSecurityConfigurerTests.java index 9b770c28ae..3644ed52ea 100644 --- a/config/src/test/java/org/springframework/security/config/http/customconfigurer/CustomHttpSecurityConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/http/customconfigurer/CustomHttpSecurityConfigurerTests.java @@ -20,9 +20,9 @@ import java.util.Properties; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; @@ -57,7 +57,7 @@ public class CustomHttpSecurityConfigurerTests { MockFilterChain chain; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest("GET", ""); this.response = new MockHttpServletResponse(); @@ -65,7 +65,7 @@ public class CustomHttpSecurityConfigurerTests { this.request.setMethod("GET"); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/method/GlobalMethodSecurityBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/method/GlobalMethodSecurityBeanDefinitionParserTests.java index f4f3ee7ac2..c4d08dc529 100644 --- a/config/src/test/java/org/springframework/security/config/method/GlobalMethodSecurityBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/method/GlobalMethodSecurityBeanDefinitionParserTests.java @@ -19,8 +19,8 @@ package org.springframework.security.config.method; import java.util.ArrayList; import java.util.List; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.aop.Advisor; import org.springframework.aop.framework.Advised; @@ -86,7 +86,7 @@ public class GlobalMethodSecurityBeanDefinitionParserTests { this.target = (BusinessService) this.appContext.getBean("target"); } - @After + @AfterEach public void closeAppContext() { if (this.appContext != null) { this.appContext.close(); diff --git a/config/src/test/java/org/springframework/security/config/method/InterceptMethodsBeanDefinitionDecoratorTests.java b/config/src/test/java/org/springframework/security/config/method/InterceptMethodsBeanDefinitionDecoratorTests.java index 2fb131b8b9..15e375b618 100644 --- a/config/src/test/java/org/springframework/security/config/method/InterceptMethodsBeanDefinitionDecoratorTests.java +++ b/config/src/test/java/org/springframework/security/config/method/InterceptMethodsBeanDefinitionDecoratorTests.java @@ -16,10 +16,10 @@ package org.springframework.security.config.method; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; @@ -37,7 +37,7 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; /** * @author Luke Taylor */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(locations = "classpath:org/springframework/security/config/method-security.xml") public class InterceptMethodsBeanDefinitionDecoratorTests implements ApplicationContextAware { @@ -59,13 +59,13 @@ public class InterceptMethodsBeanDefinitionDecoratorTests implements Application private ApplicationContext appContext; - @BeforeClass + @BeforeAll public static void loadContext() { // Set value for placeholder System.setProperty("admin.role", "ROLE_ADMIN"); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/method/Jsr250AnnotationDrivenBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/method/Jsr250AnnotationDrivenBeanDefinitionParserTests.java index 9c43ad33ca..0e699b7366 100644 --- a/config/src/test/java/org/springframework/security/config/method/Jsr250AnnotationDrivenBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/method/Jsr250AnnotationDrivenBeanDefinitionParserTests.java @@ -16,9 +16,9 @@ package org.springframework.security.config.method; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.annotation.BusinessService; @@ -40,7 +40,7 @@ public class Jsr250AnnotationDrivenBeanDefinitionParserTests { private BusinessService target; - @Before + @BeforeEach public void loadContext() { // @formatter:off this.appContext = new InMemoryXmlApplicationContext( @@ -51,7 +51,7 @@ public class Jsr250AnnotationDrivenBeanDefinitionParserTests { this.target = (BusinessService) this.appContext.getBean("target"); } - @After + @AfterEach public void closeAppContext() { if (this.appContext != null) { this.appContext.close(); diff --git a/config/src/test/java/org/springframework/security/config/method/MethodSecurityBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/method/MethodSecurityBeanDefinitionParserTests.java index 5a8b69457a..d308e3f4e3 100644 --- a/config/src/test/java/org/springframework/security/config/method/MethodSecurityBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/method/MethodSecurityBeanDefinitionParserTests.java @@ -26,8 +26,8 @@ import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.jetbrains.annotations.NotNull; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.AnnotationConfigurationException; @@ -45,7 +45,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithAnonymousUser; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; /** * @author Josh Cummings */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class MethodSecurityBeanDefinitionParserTests { diff --git a/config/src/test/java/org/springframework/security/config/method/PreAuthorizeTests.java b/config/src/test/java/org/springframework/security/config/method/PreAuthorizeTests.java index 9a4e5cdea0..8a6e982913 100644 --- a/config/src/test/java/org/springframework/security/config/method/PreAuthorizeTests.java +++ b/config/src/test/java/org/springframework/security/config/method/PreAuthorizeTests.java @@ -16,16 +16,16 @@ package org.springframework.security.config.method; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -33,14 +33,14 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Rob Winch * */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration public class PreAuthorizeTests { @Autowired PreAuthorizeServiceImpl service; - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/method/Sec2196Tests.java b/config/src/test/java/org/springframework/security/config/method/Sec2196Tests.java index fa1067e63a..fbdf043e6c 100644 --- a/config/src/test/java/org/springframework/security/config/method/Sec2196Tests.java +++ b/config/src/test/java/org/springframework/security/config/method/Sec2196Tests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.method; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.security.access.AccessDeniedException; @@ -60,7 +60,7 @@ public class Sec2196Tests { this.context = new InMemoryXmlApplicationContext(context); } - @After + @AfterEach public void closeAppContext() { if (this.context != null) { this.context.close(); diff --git a/config/src/test/java/org/springframework/security/config/method/SecuredAnnotationDrivenBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/method/SecuredAnnotationDrivenBeanDefinitionParserTests.java index ceb72bdc05..4b760367df 100644 --- a/config/src/test/java/org/springframework/security/config/method/SecuredAnnotationDrivenBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/method/SecuredAnnotationDrivenBeanDefinitionParserTests.java @@ -22,9 +22,9 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.annotation.BusinessService; @@ -47,7 +47,7 @@ public class SecuredAnnotationDrivenBeanDefinitionParserTests { private BusinessService target; - @Before + @BeforeEach public void loadContext() { SecurityContextHolder.clearContext(); this.appContext = new InMemoryXmlApplicationContext( @@ -57,7 +57,7 @@ public class SecuredAnnotationDrivenBeanDefinitionParserTests { this.target = (BusinessService) this.appContext.getBean("target"); } - @After + @AfterEach public void closeAppContext() { if (this.appContext != null) { this.appContext.close(); diff --git a/config/src/test/java/org/springframework/security/config/method/SecuredTests.java b/config/src/test/java/org/springframework/security/config/method/SecuredTests.java index 1a2504f32c..155f97422f 100644 --- a/config/src/test/java/org/springframework/security/config/method/SecuredTests.java +++ b/config/src/test/java/org/springframework/security/config/method/SecuredTests.java @@ -16,16 +16,16 @@ package org.springframework.security.config.method; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -33,14 +33,14 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Rob Winch * */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration public class SecuredTests { @Autowired SecuredServiceImpl service; - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/config/src/test/java/org/springframework/security/config/method/configuration/Gh4020GlobalMethodSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/method/configuration/Gh4020GlobalMethodSecurityConfigurationTests.java index 3d1da6e0ae..5c3b06d902 100644 --- a/config/src/test/java/org/springframework/security/config/method/configuration/Gh4020GlobalMethodSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/method/configuration/Gh4020GlobalMethodSecurityConfigurationTests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.method.configuration; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -29,7 +29,7 @@ import org.springframework.security.authentication.AuthenticationCredentialsNotF import org.springframework.security.authentication.AuthenticationTrustResolver; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.Mockito.mock; @@ -37,7 +37,7 @@ import static org.mockito.Mockito.mock; /** * @author Rob Winch */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration public class Gh4020GlobalMethodSecurityConfigurationTests { diff --git a/config/src/test/java/org/springframework/security/config/method/sec2136/Sec2136Tests.java b/config/src/test/java/org/springframework/security/config/method/sec2136/Sec2136Tests.java index 4951e56206..bb98a0ee23 100644 --- a/config/src/test/java/org/springframework/security/config/method/sec2136/Sec2136Tests.java +++ b/config/src/test/java/org/springframework/security/config/method/sec2136/Sec2136Tests.java @@ -16,17 +16,17 @@ package org.springframework.security.config.method.sec2136; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; /** * @author Rob Winch * @since 3.2 */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration("sec2136.xml") public class Sec2136Tests { diff --git a/config/src/test/java/org/springframework/security/config/method/sec2499/Sec2499Tests.java b/config/src/test/java/org/springframework/security/config/method/sec2499/Sec2499Tests.java index 745c60eaa5..8fbc0963ca 100644 --- a/config/src/test/java/org/springframework/security/config/method/sec2499/Sec2499Tests.java +++ b/config/src/test/java/org/springframework/security/config/method/sec2499/Sec2499Tests.java @@ -16,8 +16,8 @@ package org.springframework.security.config.method.sec2499; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.GenericXmlApplicationContext; @@ -31,7 +31,7 @@ public class Sec2499Tests { private GenericXmlApplicationContext child; - @After + @AfterEach public void cleanup() { if (this.parent != null) { this.parent.close(); diff --git a/config/src/test/java/org/springframework/security/config/oauth2/client/ClientRegistrationsBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/oauth2/client/ClientRegistrationsBeanDefinitionParserTests.java index e283a639a8..6ebe8ec22e 100644 --- a/config/src/test/java/org/springframework/security/config/oauth2/client/ClientRegistrationsBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/oauth2/client/ClientRegistrationsBeanDefinitionParserTests.java @@ -18,9 +18,9 @@ package org.springframework.security.config.oauth2.client; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.After; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; @@ -130,7 +130,7 @@ public class ClientRegistrationsBeanDefinitionParserTests { private MockWebServer server; - @After + @AfterEach public void cleanup() throws Exception { if (this.server != null) { this.server.shutdown(); diff --git a/config/src/test/java/org/springframework/security/config/oauth2/client/CommonOAuth2ProviderTests.java b/config/src/test/java/org/springframework/security/config/oauth2/client/CommonOAuth2ProviderTests.java index 584a0c4eb7..eefb9f2049 100644 --- a/config/src/test/java/org/springframework/security/config/oauth2/client/CommonOAuth2ProviderTests.java +++ b/config/src/test/java/org/springframework/security/config/oauth2/client/CommonOAuth2ProviderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.config.oauth2.client; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.ClientRegistration.ProviderDetails; diff --git a/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanPropertiesResourceITests.java b/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanPropertiesResourceITests.java index d1c937dd65..d70832f9bc 100644 --- a/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanPropertiesResourceITests.java +++ b/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanPropertiesResourceITests.java @@ -16,15 +16,15 @@ package org.springframework.security.config.provisioning; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.provisioning.UserDetailsManager; import org.springframework.security.util.InMemoryResource; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class UserDetailsManagerResourceFactoryBeanPropertiesResourceITests { @Autowired diff --git a/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanPropertiesResourceLocationITests.java b/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanPropertiesResourceLocationITests.java index 5138dd984d..7dd02fd671 100644 --- a/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanPropertiesResourceLocationITests.java +++ b/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanPropertiesResourceLocationITests.java @@ -16,14 +16,14 @@ package org.springframework.security.config.provisioning; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.provisioning.UserDetailsManager; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class UserDetailsManagerResourceFactoryBeanPropertiesResourceLocationITests { @Autowired diff --git a/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanStringITests.java b/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanStringITests.java index af4fccbd23..9a7701fd21 100644 --- a/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanStringITests.java +++ b/config/src/test/java/org/springframework/security/config/provisioning/UserDetailsManagerResourceFactoryBeanStringITests.java @@ -16,14 +16,14 @@ package org.springframework.security.config.provisioning; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.provisioning.UserDetailsManager; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class UserDetailsManagerResourceFactoryBeanStringITests { @Autowired diff --git a/config/src/test/java/org/springframework/security/config/web/server/AuthorizeExchangeSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/AuthorizeExchangeSpecTests.java index 0559e635c2..f47a095f09 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/AuthorizeExchangeSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/AuthorizeExchangeSpecTests.java @@ -16,7 +16,7 @@ package org.springframework.security.config.web.server; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.web.reactive.ServerHttpSecurityConfigurationBuilder; diff --git a/config/src/test/java/org/springframework/security/config/web/server/CorsSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/CorsSpecTests.java index 71ee7b605b..2ad6cf7b39 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/CorsSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/CorsSpecTests.java @@ -22,11 +22,11 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationContext; import org.springframework.core.ResolvableType; @@ -45,7 +45,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CorsSpecTests { @Mock @@ -60,7 +60,7 @@ public class CorsSpecTests { Set headerNamesNotPresent = new HashSet<>(); - @Before + @BeforeEach public void setup() { this.http = new TestingServerHttpSecurity().applicationContext(this.context); CorsConfiguration value = new CorsConfiguration(); diff --git a/config/src/test/java/org/springframework/security/config/web/server/ExceptionHandlingSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/ExceptionHandlingSpecTests.java index c278be38f4..f360ed40bb 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/ExceptionHandlingSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/ExceptionHandlingSpecTests.java @@ -16,7 +16,7 @@ package org.springframework.security.config.web.server; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.security.config.annotation.web.reactive.ServerHttpSecurityConfigurationBuilder; 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 9d06680efd..f737516bf2 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 @@ -16,7 +16,7 @@ package org.springframework.security.config.web.server; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; diff --git a/config/src/test/java/org/springframework/security/config/web/server/HeaderSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/HeaderSpecTests.java index 6e51e7c6ec..a3167f2d14 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/HeaderSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/HeaderSpecTests.java @@ -22,8 +22,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.http.HttpHeaders; @@ -62,7 +62,7 @@ public class HeaderSpecTests { private Set headerNamesNotPresent = new HashSet<>(); - @Before + @BeforeEach public void setup() { this.expectedHeaders.add(StrictTransportSecurityServerHttpHeadersWriter.STRICT_TRANSPORT_SECURITY, "max-age=31536000 ; includeSubDomains"); diff --git a/config/src/test/java/org/springframework/security/config/web/server/HttpsRedirectSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/HttpsRedirectSpecTests.java index 044d0820d0..425ae5eb3b 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/HttpsRedirectSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/HttpsRedirectSpecTests.java @@ -18,7 +18,7 @@ package org.springframework.security.config.web.server; import org.apache.http.HttpHeaders; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; diff --git a/config/src/test/java/org/springframework/security/config/web/server/LogoutSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/LogoutSpecTests.java index d00c38a629..a2bdd792fc 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/LogoutSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/LogoutSpecTests.java @@ -16,7 +16,7 @@ package org.springframework.security.config.web.server; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.springframework.security.config.annotation.web.reactive.ServerHttpSecurityConfigurationBuilder; diff --git a/config/src/test/java/org/springframework/security/config/web/server/OAuth2ClientSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/OAuth2ClientSpecTests.java index 171bcab955..ab4aefce9f 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/OAuth2ClientSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/OAuth2ClientSpecTests.java @@ -19,8 +19,8 @@ package org.springframework.security.config.web.server; import java.net.URI; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; @@ -53,7 +53,7 @@ import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.security.web.server.authentication.ServerAuthenticationConverter; import org.springframework.security.web.server.savedrequest.ServerRequestCache; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -69,7 +69,7 @@ import static org.mockito.Mockito.verify; * @author Parikshit Dutta * @since 5.1 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class OAuth2ClientSpecTests { diff --git a/config/src/test/java/org/springframework/security/config/web/server/OAuth2LoginTests.java b/config/src/test/java/org/springframework/security/config/web/server/OAuth2LoginTests.java index dcf4761167..b20e6a03be 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/OAuth2LoginTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/OAuth2LoginTests.java @@ -21,7 +21,7 @@ import java.util.HashMap; import java.util.Map; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.openqa.selenium.WebDriver; import reactor.core.publisher.Mono; diff --git a/config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java index f47d77aa90..6e296dc407 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java @@ -36,8 +36,8 @@ import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; import org.apache.http.HttpHeaders; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; import org.springframework.beans.factory.BeanCreationException; @@ -70,7 +70,7 @@ import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.security.web.server.authentication.HttpStatusServerEntryPoint; import org.springframework.security.web.server.authentication.ServerAuthenticationConverter; import org.springframework.security.web.server.authorization.HttpStatusServerAccessDeniedHandler; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -93,7 +93,7 @@ import static org.mockito.Mockito.verify; * Tests for * {@link org.springframework.security.config.web.server.ServerHttpSecurity.OAuth2ResourceServerSpec} */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) public class OAuth2ResourceServerSpecTests { private String expired = "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE1MzUwMzc4OTd9.jqZDDjfc2eysX44lHXEIr9XFd2S8vjIZHCccZU-dRWMRJNsQ1QN5VNnJGklqJBXJR4qgla6cmVqPOLkUHDb0sL0nxM5XuzQaG5ZzKP81RV88shFyAiT0fD-6nl1k-Fai-Fu-VkzSpNXgeONoTxDaYhdB-yxmgrgsApgmbOTE_9AcMk-FQDXQ-pL9kynccFGV0lZx4CA7cyknKN7KBxUilfIycvXODwgKCjj_1WddLTCNGYogJJSg__7NoxzqbyWd3udbHVjqYq7GsMMrGB4_2kBD4CkghOSNcRHbT_DIXowxfAVT7PAg7Q0E5ruZsr2zPZacEUDhJ6-wbvlA0FAOUg"; diff --git a/config/src/test/java/org/springframework/security/config/web/server/PasswordManagementSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/PasswordManagementSpecTests.java index dfe2ec55f0..974ae4eb8a 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/PasswordManagementSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/PasswordManagementSpecTests.java @@ -17,7 +17,7 @@ package org.springframework.security.config.web.server; import org.apache.http.HttpHeaders; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.config.annotation.web.reactive.ServerHttpSecurityConfigurationBuilder; import org.springframework.security.config.web.server.ServerHttpSecurity.PasswordManagementSpec; diff --git a/config/src/test/java/org/springframework/security/config/web/server/RequestCacheTests.java b/config/src/test/java/org/springframework/security/config/web/server/RequestCacheTests.java index b8e39e02ab..eab884ad5a 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/RequestCacheTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/RequestCacheTests.java @@ -16,7 +16,7 @@ package org.springframework.security.config.web.server; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; 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 1ecdf934ac..fdeeeb7372 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 @@ -23,12 +23,12 @@ import java.util.Optional; import java.util.stream.Collectors; import org.apache.http.HttpHeaders; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.publisher.TestPublisher; @@ -88,7 +88,7 @@ import static org.springframework.security.config.Customizer.withDefaults; * @author Eddú Meléndez * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServerHttpSecurityTests { @Mock @@ -102,7 +102,7 @@ public class ServerHttpSecurityTests { private ServerHttpSecurity http; - @Before + @BeforeEach public void setup() { this.http = ServerHttpSecurityConfigurationBuilder.http().authenticationManager(this.authenticationManager); } diff --git a/config/src/test/java/org/springframework/security/config/websocket/MessageSecurityPostProcessorTests.java b/config/src/test/java/org/springframework/security/config/websocket/MessageSecurityPostProcessorTests.java index bda928963a..077ebde9a0 100644 --- a/config/src/test/java/org/springframework/security/config/websocket/MessageSecurityPostProcessorTests.java +++ b/config/src/test/java/org/springframework/security/config/websocket/MessageSecurityPostProcessorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.config.websocket; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.GenericBeanDefinition; diff --git a/config/src/test/java/org/springframework/security/config/websocket/WebSocketMessageBrokerConfigTests.java b/config/src/test/java/org/springframework/security/config/websocket/WebSocketMessageBrokerConfigTests.java index 3e72669f57..7d135d0c15 100644 --- a/config/src/test/java/org/springframework/security/config/websocket/WebSocketMessageBrokerConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/websocket/WebSocketMessageBrokerConfigTests.java @@ -21,8 +21,8 @@ import java.util.Map; import org.assertj.core.api.ThrowableAssert; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; @@ -57,7 +57,7 @@ import org.springframework.security.web.csrf.CsrfToken; import org.springframework.security.web.csrf.DefaultCsrfToken; import org.springframework.security.web.csrf.InvalidCsrfTokenException; import org.springframework.stereotype.Controller; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -74,7 +74,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder * @author Rob Winch * @author Josh Cummings */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class WebSocketMessageBrokerConfigTests { diff --git a/config/src/test/java/org/springframework/security/htmlunit/server/WebTestClientHtmlUnitDriverBuilderTests.java b/config/src/test/java/org/springframework/security/htmlunit/server/WebTestClientHtmlUnitDriverBuilderTests.java index e3f8bb4a13..4658928c2c 100644 --- a/config/src/test/java/org/springframework/security/htmlunit/server/WebTestClientHtmlUnitDriverBuilderTests.java +++ b/config/src/test/java/org/springframework/security/htmlunit/server/WebTestClientHtmlUnitDriverBuilderTests.java @@ -19,7 +19,7 @@ package org.springframework.security.htmlunit.server; import java.net.URI; import java.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openqa.selenium.WebDriver; import reactor.core.publisher.Mono; diff --git a/config/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java b/config/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java index 7aa9c23914..ca9b4a0bb5 100644 --- a/config/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java +++ b/config/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java @@ -16,9 +16,9 @@ package org.springframework.security.intercept.method.aopalliance; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.security.ITargetObject; @@ -70,12 +70,12 @@ public class MethodSecurityInterceptorWithAopConfigTests { private AbstractXmlApplicationContext appContext; - @Before + @BeforeEach public void clearContext() { SecurityContextHolder.clearContext(); } - @After + @AfterEach public void closeAppContext() { SecurityContextHolder.clearContext(); if (this.appContext != null) { diff --git a/core/src/test/java/org/springframework/security/access/AuthenticationCredentialsNotFoundEventTests.java b/core/src/test/java/org/springframework/security/access/AuthenticationCredentialsNotFoundEventTests.java index 61476b5c6f..b8c291dde3 100644 --- a/core/src/test/java/org/springframework/security/access/AuthenticationCredentialsNotFoundEventTests.java +++ b/core/src/test/java/org/springframework/security/access/AuthenticationCredentialsNotFoundEventTests.java @@ -16,7 +16,7 @@ package org.springframework.security.access; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.event.AuthenticationCredentialsNotFoundEvent; import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; diff --git a/core/src/test/java/org/springframework/security/access/AuthorizationFailureEventTests.java b/core/src/test/java/org/springframework/security/access/AuthorizationFailureEventTests.java index 94af492ae9..fde3f5e700 100644 --- a/core/src/test/java/org/springframework/security/access/AuthorizationFailureEventTests.java +++ b/core/src/test/java/org/springframework/security/access/AuthorizationFailureEventTests.java @@ -18,7 +18,7 @@ package org.springframework.security.access; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.event.AuthorizationFailureEvent; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/access/AuthorizedEventTests.java b/core/src/test/java/org/springframework/security/access/AuthorizedEventTests.java index 370252a06c..b55a060eb8 100644 --- a/core/src/test/java/org/springframework/security/access/AuthorizedEventTests.java +++ b/core/src/test/java/org/springframework/security/access/AuthorizedEventTests.java @@ -16,7 +16,7 @@ package org.springframework.security.access; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.event.AuthorizedEvent; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/access/SecurityConfigTests.java b/core/src/test/java/org/springframework/security/access/SecurityConfigTests.java index 9551051bb8..96af5b698a 100644 --- a/core/src/test/java/org/springframework/security/access/SecurityConfigTests.java +++ b/core/src/test/java/org/springframework/security/access/SecurityConfigTests.java @@ -16,7 +16,7 @@ package org.springframework.security.access; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/core/src/test/java/org/springframework/security/access/annotation/Jsr250MethodSecurityMetadataSourceTests.java b/core/src/test/java/org/springframework/security/access/annotation/Jsr250MethodSecurityMetadataSourceTests.java index 642674a887..4c6697d6a6 100644 --- a/core/src/test/java/org/springframework/security/access/annotation/Jsr250MethodSecurityMetadataSourceTests.java +++ b/core/src/test/java/org/springframework/security/access/annotation/Jsr250MethodSecurityMetadataSourceTests.java @@ -21,8 +21,8 @@ import java.util.Collection; import javax.annotation.security.PermitAll; import javax.annotation.security.RolesAllowed; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.access.intercept.method.MockMethodInvocation; @@ -41,7 +41,7 @@ public class Jsr250MethodSecurityMetadataSourceTests { UserAllowedClass userAllowed; - @Before + @BeforeEach public void setup() { this.mds = new Jsr250MethodSecurityMetadataSource(); this.a = new A(); diff --git a/core/src/test/java/org/springframework/security/access/annotation/Jsr250VoterTests.java b/core/src/test/java/org/springframework/security/access/annotation/Jsr250VoterTests.java index 412d2fe93f..cc92d1eadf 100644 --- a/core/src/test/java/org/springframework/security/access/annotation/Jsr250VoterTests.java +++ b/core/src/test/java/org/springframework/security/access/annotation/Jsr250VoterTests.java @@ -19,7 +19,7 @@ package org.springframework.security.access.annotation; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.ConfigAttribute; diff --git a/core/src/test/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSourceTests.java b/core/src/test/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSourceTests.java index a607b56874..71d96ed75a 100644 --- a/core/src/test/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSourceTests.java +++ b/core/src/test/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSourceTests.java @@ -27,7 +27,7 @@ import java.util.Collection; import java.util.EnumSet; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.access.SecurityConfig; diff --git a/core/src/test/java/org/springframework/security/access/expression/AbstractSecurityExpressionHandlerTests.java b/core/src/test/java/org/springframework/security/access/expression/AbstractSecurityExpressionHandlerTests.java index c326f86c90..1189a10b9f 100644 --- a/core/src/test/java/org/springframework/security/access/expression/AbstractSecurityExpressionHandlerTests.java +++ b/core/src/test/java/org/springframework/security/access/expression/AbstractSecurityExpressionHandlerTests.java @@ -16,8 +16,8 @@ package org.springframework.security.access.expression; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; @@ -37,7 +37,7 @@ public class AbstractSecurityExpressionHandlerTests { private AbstractSecurityExpressionHandler handler; - @Before + @BeforeEach public void setUp() { this.handler = new AbstractSecurityExpressionHandler() { @Override diff --git a/core/src/test/java/org/springframework/security/access/expression/SecurityExpressionRootTests.java b/core/src/test/java/org/springframework/security/access/expression/SecurityExpressionRootTests.java index 9cb6564f61..b4aea57d11 100644 --- a/core/src/test/java/org/springframework/security/access/expression/SecurityExpressionRootTests.java +++ b/core/src/test/java/org/springframework/security/access/expression/SecurityExpressionRootTests.java @@ -16,8 +16,8 @@ package org.springframework.security.access.expression; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AuthenticationTrustResolver; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -38,7 +38,7 @@ public class SecurityExpressionRootTests { SecurityExpressionRoot root; - @Before + @BeforeEach public void setup() { this.root = new SecurityExpressionRoot(JOE) { }; diff --git a/core/src/test/java/org/springframework/security/access/expression/method/DefaultMethodSecurityExpressionHandlerTests.java b/core/src/test/java/org/springframework/security/access/expression/method/DefaultMethodSecurityExpressionHandlerTests.java index a1686fdeb1..2305d9afdd 100644 --- a/core/src/test/java/org/springframework/security/access/expression/method/DefaultMethodSecurityExpressionHandlerTests.java +++ b/core/src/test/java/org/springframework/security/access/expression/method/DefaultMethodSecurityExpressionHandlerTests.java @@ -23,12 +23,12 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.aopalliance.intercept.MethodInvocation; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; @@ -44,7 +44,7 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DefaultMethodSecurityExpressionHandlerTests { private DefaultMethodSecurityExpressionHandler handler; @@ -58,14 +58,14 @@ public class DefaultMethodSecurityExpressionHandlerTests { @Mock private AuthenticationTrustResolver trustResolver; - @Before + @BeforeEach public void setup() { this.handler = new DefaultMethodSecurityExpressionHandler(); given(this.methodInvocation.getThis()).willReturn(new Foo()); given(this.methodInvocation.getMethod()).willReturn(Foo.class.getMethods()[0]); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/core/src/test/java/org/springframework/security/access/expression/method/ExpressionBasedPreInvocationAdviceTests.java b/core/src/test/java/org/springframework/security/access/expression/method/ExpressionBasedPreInvocationAdviceTests.java index 29aab692cd..2a2a416c89 100644 --- a/core/src/test/java/org/springframework/security/access/expression/method/ExpressionBasedPreInvocationAdviceTests.java +++ b/core/src/test/java/org/springframework/security/access/expression/method/ExpressionBasedPreInvocationAdviceTests.java @@ -19,11 +19,11 @@ package org.springframework.security.access.expression.method; import java.util.ArrayList; import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.access.intercept.method.MockMethodInvocation; import org.springframework.security.access.prepost.PreInvocationAttribute; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException * @author Maksim Vinogradov * @since 5.2 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ExpressionBasedPreInvocationAdviceTests { @Mock @@ -46,7 +46,7 @@ public class ExpressionBasedPreInvocationAdviceTests { private ExpressionBasedPreInvocationAdvice expressionBasedPreInvocationAdvice; - @Before + @BeforeEach public void setUp() { this.expressionBasedPreInvocationAdvice = new ExpressionBasedPreInvocationAdvice(); } diff --git a/core/src/test/java/org/springframework/security/access/expression/method/MethodExpressionVoterTests.java b/core/src/test/java/org/springframework/security/access/expression/method/MethodExpressionVoterTests.java index e3e0bfcf35..017e38061d 100644 --- a/core/src/test/java/org/springframework/security/access/expression/method/MethodExpressionVoterTests.java +++ b/core/src/test/java/org/springframework/security/access/expression/method/MethodExpressionVoterTests.java @@ -23,7 +23,7 @@ import java.util.Collection; import java.util.List; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.ConfigAttribute; diff --git a/core/src/test/java/org/springframework/security/access/expression/method/MethodSecurityEvaluationContextTests.java b/core/src/test/java/org/springframework/security/access/expression/method/MethodSecurityEvaluationContextTests.java index a573263d25..32601baf57 100644 --- a/core/src/test/java/org/springframework/security/access/expression/method/MethodSecurityEvaluationContextTests.java +++ b/core/src/test/java/org/springframework/security/access/expression/method/MethodSecurityEvaluationContextTests.java @@ -19,10 +19,10 @@ package org.springframework.security.access.expression.method; import java.lang.reflect.Method; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.ParameterNameDiscoverer; import org.springframework.lang.Nullable; @@ -35,7 +35,7 @@ import static org.mockito.Mockito.doReturn; * @author shabarijonnalagadda * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MethodSecurityEvaluationContextTests { @Mock diff --git a/core/src/test/java/org/springframework/security/access/expression/method/MethodSecurityExpressionRootTests.java b/core/src/test/java/org/springframework/security/access/expression/method/MethodSecurityExpressionRootTests.java index e6c8910fd8..80d8069307 100644 --- a/core/src/test/java/org/springframework/security/access/expression/method/MethodSecurityExpressionRootTests.java +++ b/core/src/test/java/org/springframework/security/access/expression/method/MethodSecurityExpressionRootTests.java @@ -16,8 +16,8 @@ package org.springframework.security.access.expression.method; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.expression.Expression; import org.springframework.expression.spel.standard.SpelExpressionParser; @@ -50,7 +50,7 @@ public class MethodSecurityExpressionRootTests { private Authentication user; - @Before + @BeforeEach public void createContext() { this.user = mock(Authentication.class); this.root = new MethodSecurityExpressionRoot(this.user); diff --git a/core/src/test/java/org/springframework/security/access/expression/method/PrePostAnnotationSecurityMetadataSourceTests.java b/core/src/test/java/org/springframework/security/access/expression/method/PrePostAnnotationSecurityMetadataSourceTests.java index c7e19fbf89..b723e29574 100644 --- a/core/src/test/java/org/springframework/security/access/expression/method/PrePostAnnotationSecurityMetadataSourceTests.java +++ b/core/src/test/java/org/springframework/security/access/expression/method/PrePostAnnotationSecurityMetadataSourceTests.java @@ -24,8 +24,8 @@ import java.lang.annotation.Target; import java.util.Collection; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.expression.Expression; import org.springframework.security.access.ConfigAttribute; @@ -67,7 +67,7 @@ public class PrePostAnnotationSecurityMetadataSourceTests { private MockMethodInvocation annotatedAtMethodLevel; - @Before + @BeforeEach public void setUpData() throws Exception { this.voidImpl1 = new MockMethodInvocation(new ReturnVoidImpl1(), ReturnVoid.class, "doSomething", List.class); this.voidImpl2 = new MockMethodInvocation(new ReturnVoidImpl2(), ReturnVoid.class, "doSomething", List.class); diff --git a/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyAuthoritiesMapperTests.java b/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyAuthoritiesMapperTests.java index 58beb183f3..c8cbdd0dbd 100644 --- a/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyAuthoritiesMapperTests.java +++ b/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyAuthoritiesMapperTests.java @@ -18,7 +18,7 @@ package org.springframework.security.access.hierarchicalroles; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyImplTests.java b/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyImplTests.java index fb39ec87e4..dea1471b01 100644 --- a/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyImplTests.java +++ b/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyImplTests.java @@ -19,7 +19,7 @@ package org.springframework.security.access.hierarchicalroles; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyUtilsTests.java b/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyUtilsTests.java index 8230e3c0a9..eb314c7178 100644 --- a/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyUtilsTests.java +++ b/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyUtilsTests.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/core/src/test/java/org/springframework/security/access/hierarchicalroles/TestHelperTests.java b/core/src/test/java/org/springframework/security/access/hierarchicalroles/TestHelperTests.java index 111b94b8f5..0588de0b21 100644 --- a/core/src/test/java/org/springframework/security/access/hierarchicalroles/TestHelperTests.java +++ b/core/src/test/java/org/springframework/security/access/hierarchicalroles/TestHelperTests.java @@ -21,7 +21,7 @@ import java.util.Collection; import java.util.List; import org.apache.commons.collections.CollectionUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/core/src/test/java/org/springframework/security/access/intercept/AbstractSecurityInterceptorTests.java b/core/src/test/java/org/springframework/security/access/intercept/AbstractSecurityInterceptorTests.java index d2bf49792d..84f38584f6 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/AbstractSecurityInterceptorTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/AbstractSecurityInterceptorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.access.intercept; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionManager; import org.springframework.security.access.SecurityMetadataSource; diff --git a/core/src/test/java/org/springframework/security/access/intercept/AfterInvocationProviderManagerTests.java b/core/src/test/java/org/springframework/security/access/intercept/AfterInvocationProviderManagerTests.java index e2e3f0a25a..90b3851d45 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/AfterInvocationProviderManagerTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/AfterInvocationProviderManagerTests.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Vector; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.AfterInvocationProvider; diff --git a/core/src/test/java/org/springframework/security/access/intercept/InterceptorStatusTokenTests.java b/core/src/test/java/org/springframework/security/access/intercept/InterceptorStatusTokenTests.java index eb6947816a..f1a6f1f60c 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/InterceptorStatusTokenTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/InterceptorStatusTokenTests.java @@ -19,7 +19,7 @@ package org.springframework.security.access.intercept; import java.util.List; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.access.SecurityConfig; diff --git a/core/src/test/java/org/springframework/security/access/intercept/NullRunAsManagerTests.java b/core/src/test/java/org/springframework/security/access/intercept/NullRunAsManagerTests.java index da84efa8ba..8ec6d3514f 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/NullRunAsManagerTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/NullRunAsManagerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.access.intercept; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.SecurityConfig; diff --git a/core/src/test/java/org/springframework/security/access/intercept/RunAsImplAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/access/intercept/RunAsImplAuthenticationProviderTests.java index 64a1f73158..18e79ca1eb 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/RunAsImplAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/RunAsImplAuthenticationProviderTests.java @@ -16,8 +16,8 @@ package org.springframework.security.access.intercept; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -50,7 +50,7 @@ public class RunAsImplAuthenticationProviderTests { RunAsImplAuthenticationProvider provider = new RunAsImplAuthenticationProvider(); provider.setKey("my_password"); Authentication result = provider.authenticate(token); - Assert.assertTrue("Should have returned RunAsUserToken", result instanceof RunAsUserToken); + Assertions.assertTrue(result instanceof RunAsUserToken, "Should have returned RunAsUserToken"); RunAsUserToken resultCast = (RunAsUserToken) result; assertThat(resultCast.getKeyHash()).isEqualTo("my_password".hashCode()); } diff --git a/core/src/test/java/org/springframework/security/access/intercept/RunAsManagerImplTests.java b/core/src/test/java/org/springframework/security/access/intercept/RunAsManagerImplTests.java index 36050c0e1a..41eddcd218 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/RunAsManagerImplTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/RunAsManagerImplTests.java @@ -18,7 +18,7 @@ package org.springframework.security.access.intercept; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.SecurityConfig; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/access/intercept/RunAsUserTokenTests.java b/core/src/test/java/org/springframework/security/access/intercept/RunAsUserTokenTests.java index 2836038433..6d5294324c 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/RunAsUserTokenTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/RunAsUserTokenTests.java @@ -16,7 +16,7 @@ package org.springframework.security.access.intercept; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.authority.AuthorityUtils; 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 2447e49bc1..a5096f83af 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 @@ -19,9 +19,9 @@ package org.springframework.security.access.intercept.aopalliance; import java.util.List; import org.aopalliance.intercept.MethodInvocation; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.aop.framework.ProxyFactory; import org.springframework.context.ApplicationEventPublisher; @@ -84,7 +84,7 @@ public class MethodSecurityInterceptorTests { private ApplicationEventPublisher eventPublisher; - @Before + @BeforeEach public final void setUp() { SecurityContextHolder.clearContext(); this.token = new TestingAuthenticationToken("Test", "Password"); @@ -100,7 +100,7 @@ public class MethodSecurityInterceptorTests { createTarget(false); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisorTests.java b/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisorTests.java index 297705c6e5..60c95f8cbb 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisorTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/aopalliance/MethodSecurityMetadataSourceAdvisorTests.java @@ -18,7 +18,7 @@ package org.springframework.security.access.intercept.aopalliance; import java.lang.reflect.Method; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.TargetObject; import org.springframework.security.access.SecurityConfig; 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 10f4179554..cb7f742259 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 @@ -24,9 +24,9 @@ import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.Signature; import org.aspectj.lang.reflect.CodeSignature; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -82,7 +82,7 @@ public class AspectJMethodSecurityInterceptorTests { private ProceedingJoinPoint joinPoint; - @Before + @BeforeEach public final void setUp() { MockitoAnnotations.initMocks(this); SecurityContextHolder.clearContext(); @@ -108,7 +108,7 @@ public class AspectJMethodSecurityInterceptorTests { given(this.authman.authenticate(this.token)).willReturn(this.token); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/core/src/test/java/org/springframework/security/access/intercept/method/MapBasedMethodSecurityMetadataSourceTests.java b/core/src/test/java/org/springframework/security/access/intercept/method/MapBasedMethodSecurityMetadataSourceTests.java index ae3c44b91e..c06484d2a0 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/method/MapBasedMethodSecurityMetadataSourceTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/method/MapBasedMethodSecurityMetadataSourceTests.java @@ -19,8 +19,8 @@ package org.springframework.security.access.intercept.method; import java.lang.reflect.Method; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.access.SecurityConfig; @@ -46,7 +46,7 @@ public class MapBasedMethodSecurityMetadataSourceTests { private Method someMethodInteger; - @Before + @BeforeEach public void initialize() throws Exception { this.mds = new MapBasedMethodSecurityMetadataSource(); this.someMethodString = MockService.class.getMethod("someMethod", String.class); diff --git a/core/src/test/java/org/springframework/security/access/intercept/method/MethodInvocationPrivilegeEvaluatorTests.java b/core/src/test/java/org/springframework/security/access/intercept/method/MethodInvocationPrivilegeEvaluatorTests.java index a9e89fa1e5..93482a82cb 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/method/MethodInvocationPrivilegeEvaluatorTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/method/MethodInvocationPrivilegeEvaluatorTests.java @@ -19,8 +19,8 @@ package org.springframework.security.access.intercept.method; import java.util.List; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.ITargetObject; import org.springframework.security.OtherTargetObject; @@ -61,7 +61,7 @@ public class MethodInvocationPrivilegeEvaluatorTests { private final List role = SecurityConfig.createList("ROLE_IGNORED"); - @Before + @BeforeEach public final void setUp() { SecurityContextHolder.clearContext(); this.interceptor = new MethodSecurityInterceptor(); diff --git a/core/src/test/java/org/springframework/security/access/method/DelegatingMethodSecurityMetadataSourceTests.java b/core/src/test/java/org/springframework/security/access/method/DelegatingMethodSecurityMetadataSourceTests.java index cdab7177ca..c5206cc69e 100644 --- a/core/src/test/java/org/springframework/security/access/method/DelegatingMethodSecurityMetadataSourceTests.java +++ b/core/src/test/java/org/springframework/security/access/method/DelegatingMethodSecurityMetadataSourceTests.java @@ -23,7 +23,7 @@ import java.util.Collections; import java.util.List; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; import org.springframework.security.access.ConfigAttribute; diff --git a/core/src/test/java/org/springframework/security/access/prepost/PreInvocationAuthorizationAdviceVoterTests.java b/core/src/test/java/org/springframework/security/access/prepost/PreInvocationAuthorizationAdviceVoterTests.java index 417faedaab..eb15b96dbd 100644 --- a/core/src/test/java/org/springframework/security/access/prepost/PreInvocationAuthorizationAdviceVoterTests.java +++ b/core/src/test/java/org/springframework/security/access/prepost/PreInvocationAuthorizationAdviceVoterTests.java @@ -17,18 +17,18 @@ package org.springframework.security.access.prepost; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.aop.ProxyMethodInvocation; import org.springframework.security.access.intercept.aspectj.MethodInvocationAdapter; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class PreInvocationAuthorizationAdviceVoterTests { @Mock @@ -36,7 +36,7 @@ public class PreInvocationAuthorizationAdviceVoterTests { private PreInvocationAuthorizationAdviceVoter voter; - @Before + @BeforeEach public void setUp() { this.voter = new PreInvocationAuthorizationAdviceVoter(this.authorizationAdvice); } diff --git a/core/src/test/java/org/springframework/security/access/vote/AbstractAccessDecisionManagerTests.java b/core/src/test/java/org/springframework/security/access/vote/AbstractAccessDecisionManagerTests.java index 2445afffa7..2858384015 100644 --- a/core/src/test/java/org/springframework/security/access/vote/AbstractAccessDecisionManagerTests.java +++ b/core/src/test/java/org/springframework/security/access/vote/AbstractAccessDecisionManagerTests.java @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.List; import java.util.Vector; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.ConfigAttribute; diff --git a/core/src/test/java/org/springframework/security/access/vote/AbstractAclVoterTests.java b/core/src/test/java/org/springframework/security/access/vote/AbstractAclVoterTests.java index 7cb15549ac..b6655aa1be 100644 --- a/core/src/test/java/org/springframework/security/access/vote/AbstractAclVoterTests.java +++ b/core/src/test/java/org/springframework/security/access/vote/AbstractAclVoterTests.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.Collection; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.core.Authentication; diff --git a/core/src/test/java/org/springframework/security/access/vote/AffirmativeBasedTests.java b/core/src/test/java/org/springframework/security/access/vote/AffirmativeBasedTests.java index d9058c8f27..d208cadb93 100644 --- a/core/src/test/java/org/springframework/security/access/vote/AffirmativeBasedTests.java +++ b/core/src/test/java/org/springframework/security/access/vote/AffirmativeBasedTests.java @@ -20,8 +20,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.AccessDeniedException; @@ -54,7 +54,7 @@ public class AffirmativeBasedTests { private AccessDecisionVoter deny; - @Before + @BeforeEach @SuppressWarnings("unchecked") public void setup() { this.grant = mock(AccessDecisionVoter.class); diff --git a/core/src/test/java/org/springframework/security/access/vote/AuthenticatedVoterTests.java b/core/src/test/java/org/springframework/security/access/vote/AuthenticatedVoterTests.java index 052f9a282e..1d2cfa3657 100644 --- a/core/src/test/java/org/springframework/security/access/vote/AuthenticatedVoterTests.java +++ b/core/src/test/java/org/springframework/security/access/vote/AuthenticatedVoterTests.java @@ -18,7 +18,7 @@ package org.springframework.security.access.vote; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.ConfigAttribute; diff --git a/core/src/test/java/org/springframework/security/access/vote/ConsensusBasedTests.java b/core/src/test/java/org/springframework/security/access/vote/ConsensusBasedTests.java index 160313d5ff..29258866e3 100644 --- a/core/src/test/java/org/springframework/security/access/vote/ConsensusBasedTests.java +++ b/core/src/test/java/org/springframework/security/access/vote/ConsensusBasedTests.java @@ -19,7 +19,7 @@ package org.springframework.security.access.vote; import java.util.List; import java.util.Vector; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.AccessDeniedException; diff --git a/core/src/test/java/org/springframework/security/access/vote/RoleHierarchyVoterTests.java b/core/src/test/java/org/springframework/security/access/vote/RoleHierarchyVoterTests.java index 806ec7416b..86bf83ca8f 100644 --- a/core/src/test/java/org/springframework/security/access/vote/RoleHierarchyVoterTests.java +++ b/core/src/test/java/org/springframework/security/access/vote/RoleHierarchyVoterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.access.vote; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.SecurityConfig; diff --git a/core/src/test/java/org/springframework/security/access/vote/RoleVoterTests.java b/core/src/test/java/org/springframework/security/access/vote/RoleVoterTests.java index ca6215e486..eab34e8ad9 100644 --- a/core/src/test/java/org/springframework/security/access/vote/RoleVoterTests.java +++ b/core/src/test/java/org/springframework/security/access/vote/RoleVoterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.access.vote; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.SecurityConfig; diff --git a/core/src/test/java/org/springframework/security/access/vote/UnanimousBasedTests.java b/core/src/test/java/org/springframework/security/access/vote/UnanimousBasedTests.java index 81e7b5c2f4..8674cf11a9 100644 --- a/core/src/test/java/org/springframework/security/access/vote/UnanimousBasedTests.java +++ b/core/src/test/java/org/springframework/security/access/vote/UnanimousBasedTests.java @@ -19,7 +19,7 @@ package org.springframework.security.access.vote; import java.util.List; import java.util.Vector; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDecisionVoter; import org.springframework.security.access.AccessDeniedException; diff --git a/core/src/test/java/org/springframework/security/authentication/AbstractAuthenticationTokenTests.java b/core/src/test/java/org/springframework/security/authentication/AbstractAuthenticationTokenTests.java index cbd33ad055..50fe83b212 100644 --- a/core/src/test/java/org/springframework/security/authentication/AbstractAuthenticationTokenTests.java +++ b/core/src/test/java/org/springframework/security/authentication/AbstractAuthenticationTokenTests.java @@ -18,8 +18,8 @@ package org.springframework.security.authentication; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.core.AuthenticatedPrincipal; import org.springframework.security.core.GrantedAuthority; @@ -42,7 +42,7 @@ public class AbstractAuthenticationTokenTests { private List authorities = null; - @Before + @BeforeEach public final void setUp() { this.authorities = AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"); } diff --git a/core/src/test/java/org/springframework/security/authentication/AuthenticationTrustResolverImplTests.java b/core/src/test/java/org/springframework/security/authentication/AuthenticationTrustResolverImplTests.java index fa476f0738..5ef929b5cb 100644 --- a/core/src/test/java/org/springframework/security/authentication/AuthenticationTrustResolverImplTests.java +++ b/core/src/test/java/org/springframework/security/authentication/AuthenticationTrustResolverImplTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.authority.AuthorityUtils; 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 134b3620e6..0010f96431 100644 --- a/core/src/test/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisherTests.java +++ b/core/src/test/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisherTests.java @@ -20,7 +20,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent; diff --git a/core/src/test/java/org/springframework/security/authentication/DelegatingReactiveAuthenticationManagerTests.java b/core/src/test/java/org/springframework/security/authentication/DelegatingReactiveAuthenticationManagerTests.java index 71e73e044c..59bbc448f5 100644 --- a/core/src/test/java/org/springframework/security/authentication/DelegatingReactiveAuthenticationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authentication/DelegatingReactiveAuthenticationManagerTests.java @@ -18,10 +18,10 @@ package org.springframework.security.authentication; import java.time.Duration; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -35,7 +35,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingReactiveAuthenticationManagerTests { @Mock diff --git a/core/src/test/java/org/springframework/security/authentication/ProviderManagerTests.java b/core/src/test/java/org/springframework/security/authentication/ProviderManagerTests.java index 4d9f6c8055..e0a1fe336c 100644 --- a/core/src/test/java/org/springframework/security/authentication/ProviderManagerTests.java +++ b/core/src/test/java/org/springframework/security/authentication/ProviderManagerTests.java @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.MessageSource; import org.springframework.security.core.Authentication; diff --git a/core/src/test/java/org/springframework/security/authentication/ReactiveAuthenticationManagerAdapterTests.java b/core/src/test/java/org/springframework/security/authentication/ReactiveAuthenticationManagerAdapterTests.java index 2c706dc7c3..dd47821285 100644 --- a/core/src/test/java/org/springframework/security/authentication/ReactiveAuthenticationManagerAdapterTests.java +++ b/core/src/test/java/org/springframework/security/authentication/ReactiveAuthenticationManagerAdapterTests.java @@ -16,11 +16,11 @@ package org.springframework.security.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -35,7 +35,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ReactiveAuthenticationManagerAdapterTests { @Mock @@ -46,7 +46,7 @@ public class ReactiveAuthenticationManagerAdapterTests { ReactiveAuthenticationManagerAdapter manager; - @Before + @BeforeEach public void setup() { this.manager = new ReactiveAuthenticationManagerAdapter(this.delegate); } diff --git a/core/src/test/java/org/springframework/security/authentication/ReactiveUserDetailsServiceAuthenticationManagerTests.java b/core/src/test/java/org/springframework/security/authentication/ReactiveUserDetailsServiceAuthenticationManagerTests.java index 5a4b9466e9..eabd9256c5 100644 --- a/core/src/test/java/org/springframework/security/authentication/ReactiveUserDetailsServiceAuthenticationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authentication/ReactiveUserDetailsServiceAuthenticationManagerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ReactiveUserDetailsServiceAuthenticationManagerTests { @Mock @@ -56,7 +56,7 @@ public class ReactiveUserDetailsServiceAuthenticationManagerTests { String password; - @Before + @BeforeEach public void setup() { this.manager = new UserDetailsRepositoryReactiveAuthenticationManager(this.repository); this.username = "user"; diff --git a/core/src/test/java/org/springframework/security/authentication/TestingAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/TestingAuthenticationProviderTests.java index 1435300fc8..20b2090cb5 100644 --- a/core/src/test/java/org/springframework/security/authentication/TestingAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/TestingAuthenticationProviderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.Authentication; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/core/src/test/java/org/springframework/security/authentication/TestingAuthenticationTokenTests.java b/core/src/test/java/org/springframework/security/authentication/TestingAuthenticationTokenTests.java index 8b7c6f4617..30bf436147 100644 --- a/core/src/test/java/org/springframework/security/authentication/TestingAuthenticationTokenTests.java +++ b/core/src/test/java/org/springframework/security/authentication/TestingAuthenticationTokenTests.java @@ -18,7 +18,7 @@ package org.springframework.security.authentication; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.authority.SimpleGrantedAuthority; 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 72d05fa063..24ddb2916e 100644 --- a/core/src/test/java/org/springframework/security/authentication/UserDetailsRepositoryReactiveAuthenticationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authentication/UserDetailsRepositoryReactiveAuthenticationManagerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; @@ -49,7 +49,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Eddú Meléndez * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class UserDetailsRepositoryReactiveAuthenticationManagerTests { @Mock @@ -75,7 +75,7 @@ public class UserDetailsRepositoryReactiveAuthenticationManagerTests { // @formatter:on private UserDetailsRepositoryReactiveAuthenticationManager manager; - @Before + @BeforeEach public void setup() { this.manager = new UserDetailsRepositoryReactiveAuthenticationManager(this.userDetailsService); given(this.scheduler.schedule(any())).willAnswer((a) -> { diff --git a/core/src/test/java/org/springframework/security/authentication/UsernamePasswordAuthenticationTokenTests.java b/core/src/test/java/org/springframework/security/authentication/UsernamePasswordAuthenticationTokenTests.java index 5aca769989..8c3eda3dd8 100644 --- a/core/src/test/java/org/springframework/security/authentication/UsernamePasswordAuthenticationTokenTests.java +++ b/core/src/test/java/org/springframework/security/authentication/UsernamePasswordAuthenticationTokenTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/core/src/test/java/org/springframework/security/authentication/anonymous/AnonymousAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/anonymous/AnonymousAuthenticationProviderTests.java index 9259559c2a..3b6be903dd 100644 --- a/core/src/test/java/org/springframework/security/authentication/anonymous/AnonymousAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/anonymous/AnonymousAuthenticationProviderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication.anonymous; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AnonymousAuthenticationProvider; import org.springframework.security.authentication.AnonymousAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/authentication/anonymous/AnonymousAuthenticationTokenTests.java b/core/src/test/java/org/springframework/security/authentication/anonymous/AnonymousAuthenticationTokenTests.java index 22d9bfafbd..4910b622d5 100644 --- a/core/src/test/java/org/springframework/security/authentication/anonymous/AnonymousAuthenticationTokenTests.java +++ b/core/src/test/java/org/springframework/security/authentication/anonymous/AnonymousAuthenticationTokenTests.java @@ -19,7 +19,7 @@ package org.springframework.security.authentication.anonymous; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 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 37263d90f2..73056c57fc 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 @@ -20,7 +20,7 @@ import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.dao.DataRetrievalFailureException; import org.springframework.security.authentication.AccountExpiredException; diff --git a/core/src/test/java/org/springframework/security/authentication/event/AuthenticationEventTests.java b/core/src/test/java/org/springframework/security/authentication/event/AuthenticationEventTests.java index 3671f53ca4..f2ecf729c8 100644 --- a/core/src/test/java/org/springframework/security/authentication/event/AuthenticationEventTests.java +++ b/core/src/test/java/org/springframework/security/authentication/event/AuthenticationEventTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication.event; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.DisabledException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/authentication/event/LoggerListenerTests.java b/core/src/test/java/org/springframework/security/authentication/event/LoggerListenerTests.java index 4d788d4377..1efd1e083e 100644 --- a/core/src/test/java/org/springframework/security/authentication/event/LoggerListenerTests.java +++ b/core/src/test/java/org/springframework/security/authentication/event/LoggerListenerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication.event; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.LockedException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/DefaultJaasAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/jaas/DefaultJaasAuthenticationProviderTests.java index fa25cd8494..4aa8862111 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/DefaultJaasAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/DefaultJaasAuthenticationProviderTests.java @@ -26,8 +26,8 @@ import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; import org.apache.commons.logging.Log; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.context.ApplicationEventPublisher; @@ -65,7 +65,7 @@ public class DefaultJaasAuthenticationProviderTests { private Log log; - @Before + @BeforeEach public void setUp() throws Exception { Configuration configuration = mock(Configuration.class); this.publisher = mock(ApplicationEventPublisher.class); diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/JaasAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/jaas/JaasAuthenticationProviderTests.java index 01ce3ef9f8..46ade0722d 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/JaasAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/JaasAuthenticationProviderTests.java @@ -28,8 +28,8 @@ import java.util.Set; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -65,7 +65,7 @@ public class JaasAuthenticationProviderTests { private JaasEventCheck eventCheck; - @Before + @BeforeEach public void setUp() { String resName = "/" + getClass().getName().replace('.', '/') + ".xml"; this.context = new ClassPathXmlApplicationContext(resName); diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/JaasGrantedAuthorityTests.java b/core/src/test/java/org/springframework/security/authentication/jaas/JaasGrantedAuthorityTests.java index 8310693337..8861daa15f 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/JaasGrantedAuthorityTests.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/JaasGrantedAuthorityTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication.jaas; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/Sec760Tests.java b/core/src/test/java/org/springframework/security/authentication/jaas/Sec760Tests.java index bec12f7be4..6dd80ffe06 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/Sec760Tests.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/Sec760Tests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication.jaas; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/SecurityContextLoginModuleTests.java b/core/src/test/java/org/springframework/security/authentication/jaas/SecurityContextLoginModuleTests.java index fbe3c9e792..9b631a303a 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/SecurityContextLoginModuleTests.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/SecurityContextLoginModuleTests.java @@ -23,9 +23,9 @@ import java.util.Map; import javax.security.auth.Subject; import javax.security.auth.login.LoginException; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; @@ -47,14 +47,14 @@ public class SecurityContextLoginModuleTests { private UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("principal", "credentials"); - @Before + @BeforeEach public void setUp() { this.module = new SecurityContextLoginModule(); this.module.initialize(this.subject, null, null, null); SecurityContextHolder.clearContext(); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); this.module = null; diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/memory/InMemoryConfigurationTests.java b/core/src/test/java/org/springframework/security/authentication/jaas/memory/InMemoryConfigurationTests.java index ab53c91c22..79a66e8ed4 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/memory/InMemoryConfigurationTests.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/memory/InMemoryConfigurationTests.java @@ -23,8 +23,8 @@ import java.util.Map; import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.jaas.TestLoginModule; @@ -42,7 +42,7 @@ public class InMemoryConfigurationTests { private Map mappedEntries; - @Before + @BeforeEach public void setUp() { this.defaultEntries = new AppConfigurationEntry[] { new AppConfigurationEntry(TestLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED, Collections.emptyMap()) }; diff --git a/core/src/test/java/org/springframework/security/authentication/rcp/RemoteAuthenticationManagerImplTests.java b/core/src/test/java/org/springframework/security/authentication/rcp/RemoteAuthenticationManagerImplTests.java index 8fd7fe26ec..51e89c29ce 100644 --- a/core/src/test/java/org/springframework/security/authentication/rcp/RemoteAuthenticationManagerImplTests.java +++ b/core/src/test/java/org/springframework/security/authentication/rcp/RemoteAuthenticationManagerImplTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication.rcp; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; diff --git a/core/src/test/java/org/springframework/security/authentication/rcp/RemoteAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/rcp/RemoteAuthenticationProviderTests.java index 2d7cdd1995..e227635294 100644 --- a/core/src/test/java/org/springframework/security/authentication/rcp/RemoteAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/rcp/RemoteAuthenticationProviderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.authentication.rcp; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/core/src/test/java/org/springframework/security/authentication/rememberme/RememberMeAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/rememberme/RememberMeAuthenticationProviderTests.java index 428fe348bb..cc8a1065f6 100644 --- a/core/src/test/java/org/springframework/security/authentication/rememberme/RememberMeAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/rememberme/RememberMeAuthenticationProviderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authentication.rememberme; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.RememberMeAuthenticationProvider; diff --git a/core/src/test/java/org/springframework/security/authentication/rememberme/RememberMeAuthenticationTokenTests.java b/core/src/test/java/org/springframework/security/authentication/rememberme/RememberMeAuthenticationTokenTests.java index 4e2bd6c598..fa6b817768 100644 --- a/core/src/test/java/org/springframework/security/authentication/rememberme/RememberMeAuthenticationTokenTests.java +++ b/core/src/test/java/org/springframework/security/authentication/rememberme/RememberMeAuthenticationTokenTests.java @@ -19,7 +19,7 @@ package org.springframework.security.authentication.rememberme; import java.util.Arrays; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.RememberMeAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/authorization/AuthenticatedAuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/AuthenticatedAuthorizationManagerTests.java index 375f52fb65..5bcfed5c51 100644 --- a/core/src/test/java/org/springframework/security/authorization/AuthenticatedAuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/AuthenticatedAuthorizationManagerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.authorization; import java.util.function.Supplier; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.authentication.TestingAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/authorization/AuthenticatedReactiveAuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/AuthenticatedReactiveAuthorizationManagerTests.java index 6f56f58518..4fc02e8efd 100644 --- a/core/src/test/java/org/springframework/security/authorization/AuthenticatedReactiveAuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/AuthenticatedReactiveAuthorizationManagerTests.java @@ -16,10 +16,10 @@ package org.springframework.security.authorization; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -34,7 +34,7 @@ import static org.mockito.Mockito.mock; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthenticatedReactiveAuthorizationManagerTests { @Mock diff --git a/core/src/test/java/org/springframework/security/authorization/AuthorityAuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/AuthorityAuthorizationManagerTests.java index 5c092d54d4..43d8d0631c 100644 --- a/core/src/test/java/org/springframework/security/authorization/AuthorityAuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/AuthorityAuthorizationManagerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.authorization; import java.util.function.Supplier; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/core/src/test/java/org/springframework/security/authorization/AuthorityReactiveAuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/AuthorityReactiveAuthorizationManagerTests.java index 7066a98268..2fd6ac42e4 100644 --- a/core/src/test/java/org/springframework/security/authorization/AuthorityReactiveAuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/AuthorityReactiveAuthorizationManagerTests.java @@ -18,10 +18,10 @@ package org.springframework.security.authorization; import java.util.Collections; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -36,7 +36,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthorityReactiveAuthorizationManagerTests { @Mock diff --git a/core/src/test/java/org/springframework/security/authorization/AuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/AuthorizationManagerTests.java index ee990d5f4c..3ca3cd91f7 100644 --- a/core/src/test/java/org/springframework/security/authorization/AuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/AuthorizationManagerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.authorization; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.TestingAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/authorization/method/AuthorizationManagerAfterMethodInterceptorTests.java b/core/src/test/java/org/springframework/security/authorization/method/AuthorizationManagerAfterMethodInterceptorTests.java index 26287ed97b..ddd622bfcf 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/AuthorizationManagerAfterMethodInterceptorTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/AuthorizationManagerAfterMethodInterceptorTests.java @@ -17,7 +17,7 @@ package org.springframework.security.authorization.method; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.aop.Pointcut; import org.springframework.security.authorization.AuthorizationManager; diff --git a/core/src/test/java/org/springframework/security/authorization/method/AuthorizationManagerBeforeMethodInterceptorTests.java b/core/src/test/java/org/springframework/security/authorization/method/AuthorizationManagerBeforeMethodInterceptorTests.java index 01456bd40c..38a5316771 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/AuthorizationManagerBeforeMethodInterceptorTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/AuthorizationManagerBeforeMethodInterceptorTests.java @@ -17,7 +17,7 @@ package org.springframework.security.authorization.method; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.aop.Pointcut; import org.springframework.security.authorization.AuthorizationManager; diff --git a/core/src/test/java/org/springframework/security/authorization/method/AuthorizationMethodPointcutsTests.java b/core/src/test/java/org/springframework/security/authorization/method/AuthorizationMethodPointcutsTests.java index b2bb8de7b3..12c1e4b6b8 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/AuthorizationMethodPointcutsTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/AuthorizationMethodPointcutsTests.java @@ -21,7 +21,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.aop.Pointcut; import org.springframework.aop.support.AopUtils; diff --git a/core/src/test/java/org/springframework/security/authorization/method/Jsr250AuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/method/Jsr250AuthorizationManagerTests.java index 778738bb4e..504effbab8 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/Jsr250AuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/Jsr250AuthorizationManagerTests.java @@ -24,7 +24,7 @@ import javax.annotation.security.DenyAll; import javax.annotation.security.PermitAll; import javax.annotation.security.RolesAllowed; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.annotation.AnnotationConfigurationException; import org.springframework.security.access.intercept.method.MockMethodInvocation; diff --git a/core/src/test/java/org/springframework/security/authorization/method/PostAuthorizeAuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/method/PostAuthorizeAuthorizationManagerTests.java index e6a068a4cf..b8e759c93a 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/PostAuthorizeAuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/PostAuthorizeAuthorizationManagerTests.java @@ -23,7 +23,7 @@ import java.util.Collections; import java.util.List; import java.util.function.Supplier; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.annotation.AnnotationConfigurationException; import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; diff --git a/core/src/test/java/org/springframework/security/authorization/method/PostFilterAuthorizationMethodInterceptorTests.java b/core/src/test/java/org/springframework/security/authorization/method/PostFilterAuthorizationMethodInterceptorTests.java index 8a5c9aa583..d66be22ba6 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/PostFilterAuthorizationMethodInterceptorTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/PostFilterAuthorizationMethodInterceptorTests.java @@ -20,9 +20,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import org.assertj.core.api.InstanceOfAssertFactories; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.aop.MethodMatcher; import org.springframework.core.annotation.AnnotationConfigurationException; @@ -44,12 +44,12 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ public class PostFilterAuthorizationMethodInterceptorTests { - @Before + @BeforeEach public void setUp() { SecurityContextHolder.getContext().setAuthentication(TestAuthentication.authenticatedUser()); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/core/src/test/java/org/springframework/security/authorization/method/PreAuthorizeAuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/method/PreAuthorizeAuthorizationManagerTests.java index 0247617cfb..d570923666 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/PreAuthorizeAuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/PreAuthorizeAuthorizationManagerTests.java @@ -20,7 +20,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.function.Supplier; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.annotation.AnnotationConfigurationException; import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; diff --git a/core/src/test/java/org/springframework/security/authorization/method/PreFilterAuthorizationMethodInterceptorTests.java b/core/src/test/java/org/springframework/security/authorization/method/PreFilterAuthorizationMethodInterceptorTests.java index 78432a5e5d..b037a14f08 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/PreFilterAuthorizationMethodInterceptorTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/PreFilterAuthorizationMethodInterceptorTests.java @@ -21,9 +21,9 @@ import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.aop.MethodMatcher; import org.springframework.core.annotation.AnnotationConfigurationException; @@ -46,12 +46,12 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; */ public class PreFilterAuthorizationMethodInterceptorTests { - @Before + @BeforeEach public void setUp() { SecurityContextHolder.getContext().setAuthentication(TestAuthentication.authenticatedUser()); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/core/src/test/java/org/springframework/security/authorization/method/SecuredAuthorizationManagerTests.java b/core/src/test/java/org/springframework/security/authorization/method/SecuredAuthorizationManagerTests.java index 3f1e507731..db730feb36 100644 --- a/core/src/test/java/org/springframework/security/authorization/method/SecuredAuthorizationManagerTests.java +++ b/core/src/test/java/org/springframework/security/authorization/method/SecuredAuthorizationManagerTests.java @@ -20,7 +20,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.function.Supplier; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.annotation.AnnotationConfigurationException; import org.springframework.security.access.annotation.Secured; diff --git a/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextExecutorServiceTests.java b/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextExecutorServiceTests.java index bb1867b5c2..557cf44b77 100644 --- a/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextExecutorServiceTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextExecutorServiceTests.java @@ -22,8 +22,8 @@ import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import static org.assertj.core.api.Assertions.assertThat; @@ -52,7 +52,7 @@ public abstract class AbstractDelegatingSecurityContextExecutorServiceTests protected DelegatingSecurityContextExecutorService executor; - @Before + @BeforeEach public final void setUpExecutorService() { this.executor = create(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextExecutorTests.java b/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextExecutorTests.java index 0c54307dbe..58b4acc5af 100644 --- a/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextExecutorTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextExecutorTests.java @@ -19,7 +19,7 @@ package org.springframework.security.concurrent; import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextScheduledExecutorServiceTests.java b/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextScheduledExecutorServiceTests.java index 25dc94c333..827e1b40df 100644 --- a/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextScheduledExecutorServiceTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextScheduledExecutorServiceTests.java @@ -19,8 +19,8 @@ package org.springframework.security.concurrent; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import static org.assertj.core.api.Assertions.assertThatObject; @@ -45,7 +45,7 @@ public abstract class AbstractDelegatingSecurityContextScheduledExecutorServiceT private DelegatingSecurityContextScheduledExecutorService executor; - @Before + @BeforeEach public final void setUpExecutor() { this.executor = create(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextTestSupport.java b/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextTestSupport.java index 75cc49275f..7ebd72bd1d 100644 --- a/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextTestSupport.java +++ b/core/src/test/java/org/springframework/security/concurrent/AbstractDelegatingSecurityContextTestSupport.java @@ -18,14 +18,14 @@ package org.springframework.security.concurrent; import java.util.concurrent.Callable; -import org.junit.After; -import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; @@ -40,7 +40,7 @@ import static org.mockito.ArgumentMatchers.eq; * @since 3.2 * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public abstract class AbstractDelegatingSecurityContextTestSupport { @Mock @@ -86,12 +86,12 @@ public abstract class AbstractDelegatingSecurityContextTestSupport { .thenReturn(this.wrappedRunnable); } - @Before + @BeforeEach public final void setContext() { SecurityContextHolder.setContext(this.currentSecurityContext); } - @After + @AfterEach public final void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextExecutorServiceTests.java b/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextExecutorServiceTests.java index 1ace46f691..5c8c6586cf 100644 --- a/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextExecutorServiceTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextExecutorServiceTests.java @@ -16,7 +16,7 @@ package org.springframework.security.concurrent; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -31,7 +31,7 @@ import org.springframework.security.core.context.SecurityContext; public class CurrentDelegatingSecurityContextExecutorServiceTests extends AbstractDelegatingSecurityContextExecutorServiceTests { - @Before + @BeforeEach public void setUp() throws Exception { super.currentSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextExecutorTests.java b/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextExecutorTests.java index ff5cb3eb28..be9dc7279a 100644 --- a/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextExecutorTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextExecutorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.concurrent; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -30,7 +30,7 @@ import org.springframework.security.core.context.SecurityContext; */ public class CurrentDelegatingSecurityContextExecutorTests extends AbstractDelegatingSecurityContextExecutorTests { - @Before + @BeforeEach public void setUp() throws Exception { super.currentSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextScheduledExecutorServiceTests.java b/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextScheduledExecutorServiceTests.java index c13d980969..7b4504c7e7 100644 --- a/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextScheduledExecutorServiceTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/CurrentDelegatingSecurityContextScheduledExecutorServiceTests.java @@ -16,7 +16,7 @@ package org.springframework.security.concurrent; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -31,7 +31,7 @@ import org.springframework.security.core.context.SecurityContext; public class CurrentDelegatingSecurityContextScheduledExecutorServiceTests extends AbstractDelegatingSecurityContextScheduledExecutorServiceTests { - @Before + @BeforeEach public void setUp() throws Exception { this.currentSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextCallableTests.java b/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextCallableTests.java index e3122a3ac7..2d830f6f03 100644 --- a/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextCallableTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextCallableTests.java @@ -21,14 +21,14 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.internal.stubbing.answers.Returns; import org.mockito.invocation.InvocationOnMock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; @@ -42,7 +42,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 3.2 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingSecurityContextCallableTests { @Mock @@ -60,7 +60,7 @@ public class DelegatingSecurityContextCallableTests { private SecurityContext originalSecurityContext; - @Before + @BeforeEach @SuppressWarnings("serial") public void setUp() throws Exception { this.originalSecurityContext = SecurityContextHolder.createEmptyContext(); @@ -75,7 +75,7 @@ public class DelegatingSecurityContextCallableTests { this.executor = Executors.newFixedThreadPool(1); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnableTests.java b/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnableTests.java index 5f13ce3da0..4f01a2b255 100644 --- a/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnableTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnableTests.java @@ -20,12 +20,12 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; import org.springframework.core.task.SyncTaskExecutor; @@ -42,7 +42,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 3.2 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingSecurityContextRunnableTests { @Mock @@ -60,7 +60,7 @@ public class DelegatingSecurityContextRunnableTests { private SecurityContext originalSecurityContext; - @Before + @BeforeEach public void setUp() { this.originalSecurityContext = SecurityContextHolder.createEmptyContext(); willAnswer((Answer) (invocation) -> { @@ -70,7 +70,7 @@ public class DelegatingSecurityContextRunnableTests { this.executor = Executors.newFixedThreadPool(1); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextSupportTests.java b/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextSupportTests.java index 948e059521..fe37ccdded 100644 --- a/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextSupportTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/DelegatingSecurityContextSupportTests.java @@ -16,7 +16,7 @@ package org.springframework.security.concurrent; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.context.SecurityContext; diff --git a/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextExecutorServiceTests.java b/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextExecutorServiceTests.java index 27b82372c8..bada6f903b 100644 --- a/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextExecutorServiceTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextExecutorServiceTests.java @@ -16,7 +16,7 @@ package org.springframework.security.concurrent; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -31,7 +31,7 @@ import org.springframework.security.core.context.SecurityContext; public class ExplicitDelegatingSecurityContextExecutorServiceTests extends AbstractDelegatingSecurityContextExecutorServiceTests { - @Before + @BeforeEach public void setUp() throws Exception { super.explicitSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextExecutorTests.java b/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextExecutorTests.java index bc90ea3843..cc74da5c2f 100644 --- a/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextExecutorTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextExecutorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.concurrent; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -30,7 +30,7 @@ import org.springframework.security.core.context.SecurityContext; */ public class ExplicitDelegatingSecurityContextExecutorTests extends AbstractDelegatingSecurityContextExecutorTests { - @Before + @BeforeEach public void setUp() throws Exception { super.explicitSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextScheduledExecutorServiceTests.java b/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextScheduledExecutorServiceTests.java index 3f7423cb79..c0413cabaf 100644 --- a/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextScheduledExecutorServiceTests.java +++ b/core/src/test/java/org/springframework/security/concurrent/ExplicitDelegatingSecurityContextScheduledExecutorServiceTests.java @@ -16,7 +16,7 @@ package org.springframework.security.concurrent; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -31,7 +31,7 @@ import org.springframework.security.core.context.SecurityContext; public class ExplicitDelegatingSecurityContextScheduledExecutorServiceTests extends AbstractDelegatingSecurityContextScheduledExecutorServiceTests { - @Before + @BeforeEach public void setUp() throws Exception { this.explicitSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/context/DelegatingApplicationListenerTests.java b/core/src/test/java/org/springframework/security/context/DelegatingApplicationListenerTests.java index 8d66830b52..0488c5e36d 100644 --- a/core/src/test/java/org/springframework/security/context/DelegatingApplicationListenerTests.java +++ b/core/src/test/java/org/springframework/security/context/DelegatingApplicationListenerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.context; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationEvent; import org.springframework.context.event.SmartApplicationListener; @@ -31,7 +31,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingApplicationListenerTests { @Mock @@ -41,7 +41,7 @@ public class DelegatingApplicationListenerTests { DelegatingApplicationListener listener; - @Before + @BeforeEach public void setup() { this.event = new ApplicationEvent(this) { }; diff --git a/core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java b/core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java index 3d70a84d93..446f48d5eb 100644 --- a/core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java +++ b/core/src/test/java/org/springframework/security/converter/RsaKeyConvertersTests.java @@ -24,7 +24,7 @@ import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; diff --git a/core/src/test/java/org/springframework/security/core/JavaVersionTests.java b/core/src/test/java/org/springframework/security/core/JavaVersionTests.java index 5f2602f7ab..80a8e2ef38 100644 --- a/core/src/test/java/org/springframework/security/core/JavaVersionTests.java +++ b/core/src/test/java/org/springframework/security/core/JavaVersionTests.java @@ -19,7 +19,7 @@ package org.springframework.security.core; import java.io.DataInputStream; import java.io.InputStream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; 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 003862311d..fe2bfbadb1 100644 --- a/core/src/test/java/org/springframework/security/core/SpringSecurityCoreVersionTests.java +++ b/core/src/test/java/org/springframework/security/core/SpringSecurityCoreVersionTests.java @@ -21,14 +21,14 @@ import java.lang.reflect.Method; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Answers; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.SpringVersion; import org.springframework.util.ReflectionUtils; @@ -46,7 +46,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Luke Taylor * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SpringSecurityCoreVersionTests { @Mock @@ -58,13 +58,13 @@ public class SpringSecurityCoreVersionTests { @Mock(answer = Answers.CALLS_REAL_METHODS) private MockedStatic springSecurityCoreVersion; - @Before + @BeforeEach public void setup() throws Exception { Field logger = ReflectionUtils.findField(SpringSecurityCoreVersion.class, "logger"); StaticFinalReflectionUtils.setField(logger, this.logger); } - @After + @AfterEach public void cleanup() throws Exception { System.clearProperty(getDisableChecksProperty()); Field logger = ReflectionUtils.findField(SpringSecurityCoreVersion.class, "logger"); diff --git a/core/src/test/java/org/springframework/security/core/SpringSecurityMessageSourceTests.java b/core/src/test/java/org/springframework/security/core/SpringSecurityMessageSourceTests.java index b795c3609b..1051ceb142 100644 --- a/core/src/test/java/org/springframework/security/core/SpringSecurityMessageSourceTests.java +++ b/core/src/test/java/org/springframework/security/core/SpringSecurityMessageSourceTests.java @@ -18,7 +18,7 @@ package org.springframework.security.core; import java.util.Locale; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.support.MessageSourceAccessor; diff --git a/core/src/test/java/org/springframework/security/core/authority/AuthorityUtilsTests.java b/core/src/test/java/org/springframework/security/core/authority/AuthorityUtilsTests.java index 34af08348f..38a4a0a19b 100644 --- a/core/src/test/java/org/springframework/security/core/authority/AuthorityUtilsTests.java +++ b/core/src/test/java/org/springframework/security/core/authority/AuthorityUtilsTests.java @@ -19,7 +19,7 @@ package org.springframework.security.core.authority; import java.util.List; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; diff --git a/core/src/test/java/org/springframework/security/core/authority/SimpleGrantedAuthorityTests.java b/core/src/test/java/org/springframework/security/core/authority/SimpleGrantedAuthorityTests.java index 09177a9fef..cb75f3f2f9 100644 --- a/core/src/test/java/org/springframework/security/core/authority/SimpleGrantedAuthorityTests.java +++ b/core/src/test/java/org/springframework/security/core/authority/SimpleGrantedAuthorityTests.java @@ -16,7 +16,7 @@ package org.springframework.security.core.authority; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; diff --git a/core/src/test/java/org/springframework/security/core/authority/mapping/MapBasedAttributes2GrantedAuthoritiesMapperTests.java b/core/src/test/java/org/springframework/security/core/authority/mapping/MapBasedAttributes2GrantedAuthoritiesMapperTests.java index 73c39acfdd..75ceeb7379 100644 --- a/core/src/test/java/org/springframework/security/core/authority/mapping/MapBasedAttributes2GrantedAuthoritiesMapperTests.java +++ b/core/src/test/java/org/springframework/security/core/authority/mapping/MapBasedAttributes2GrantedAuthoritiesMapperTests.java @@ -22,7 +22,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; diff --git a/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleAuthoritiesMapperTests.java b/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleAuthoritiesMapperTests.java index 61ff94419d..618acbe3d8 100644 --- a/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleAuthoritiesMapperTests.java +++ b/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleAuthoritiesMapperTests.java @@ -19,7 +19,7 @@ package org.springframework.security.core.authority.mapping; import java.util.List; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleMappableRolesRetrieverTests.java b/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleMappableRolesRetrieverTests.java index 2c3cdab572..547b49e923 100644 --- a/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleMappableRolesRetrieverTests.java +++ b/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleMappableRolesRetrieverTests.java @@ -18,7 +18,7 @@ package org.springframework.security.core.authority.mapping; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.util.StringUtils; diff --git a/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleRoles2GrantedAuthoritiesMapperTests.java b/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleRoles2GrantedAuthoritiesMapperTests.java index 24ba61759f..43520ed21a 100644 --- a/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleRoles2GrantedAuthoritiesMapperTests.java +++ b/core/src/test/java/org/springframework/security/core/authority/mapping/SimpleRoles2GrantedAuthoritiesMapperTests.java @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; diff --git a/core/src/test/java/org/springframework/security/core/context/ReactiveSecurityContextHolderTests.java b/core/src/test/java/org/springframework/security/core/context/ReactiveSecurityContextHolderTests.java index df166b481b..178bcb081d 100644 --- a/core/src/test/java/org/springframework/security/core/context/ReactiveSecurityContextHolderTests.java +++ b/core/src/test/java/org/springframework/security/core/context/ReactiveSecurityContextHolderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.core.context; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; diff --git a/core/src/test/java/org/springframework/security/core/context/SecurityContextHolderTests.java b/core/src/test/java/org/springframework/security/core/context/SecurityContextHolderTests.java index 910a8cdd82..11fd9be02b 100644 --- a/core/src/test/java/org/springframework/security/core/context/SecurityContextHolderTests.java +++ b/core/src/test/java/org/springframework/security/core/context/SecurityContextHolderTests.java @@ -16,8 +16,8 @@ package org.springframework.security.core.context; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ public class SecurityContextHolderTests { - @Before + @BeforeEach public final void setUp() { SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL); } diff --git a/core/src/test/java/org/springframework/security/core/context/SecurityContextImplTests.java b/core/src/test/java/org/springframework/security/core/context/SecurityContextImplTests.java index d6e2f5bbbf..645151b7cf 100644 --- a/core/src/test/java/org/springframework/security/core/context/SecurityContextImplTests.java +++ b/core/src/test/java/org/springframework/security/core/context/SecurityContextImplTests.java @@ -16,7 +16,7 @@ package org.springframework.security.core.context; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/core/src/test/java/org/springframework/security/core/parameters/AnnotationParameterNameDiscovererTests.java b/core/src/test/java/org/springframework/security/core/parameters/AnnotationParameterNameDiscovererTests.java index 2627f17d47..f16b7243b1 100644 --- a/core/src/test/java/org/springframework/security/core/parameters/AnnotationParameterNameDiscovererTests.java +++ b/core/src/test/java/org/springframework/security/core/parameters/AnnotationParameterNameDiscovererTests.java @@ -16,8 +16,8 @@ package org.springframework.security.core.parameters; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.access.method.P; import org.springframework.util.ReflectionUtils; @@ -28,7 +28,7 @@ public class AnnotationParameterNameDiscovererTests { private AnnotationParameterNameDiscoverer discoverer; - @Before + @BeforeEach public void setup() { this.discoverer = new AnnotationParameterNameDiscoverer(P.class.getName()); } diff --git a/core/src/test/java/org/springframework/security/core/parameters/DefaultSecurityParameterNameDiscovererTests.java b/core/src/test/java/org/springframework/security/core/parameters/DefaultSecurityParameterNameDiscovererTests.java index bbaf08c7a1..6acc8ca21c 100644 --- a/core/src/test/java/org/springframework/security/core/parameters/DefaultSecurityParameterNameDiscovererTests.java +++ b/core/src/test/java/org/springframework/security/core/parameters/DefaultSecurityParameterNameDiscovererTests.java @@ -20,8 +20,8 @@ import java.util.Arrays; import java.util.List; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.LocalVariableTableParameterNameDiscoverer; @@ -39,7 +39,7 @@ public class DefaultSecurityParameterNameDiscovererTests { private DefaultSecurityParameterNameDiscoverer discoverer; - @Before + @BeforeEach public void setup() { this.discoverer = new DefaultSecurityParameterNameDiscoverer(); } diff --git a/core/src/test/java/org/springframework/security/core/session/SessionInformationTests.java b/core/src/test/java/org/springframework/security/core/session/SessionInformationTests.java index 626fcea0ed..e66335017f 100644 --- a/core/src/test/java/org/springframework/security/core/session/SessionInformationTests.java +++ b/core/src/test/java/org/springframework/security/core/session/SessionInformationTests.java @@ -18,7 +18,7 @@ package org.springframework.security.core.session; import java.util.Date; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/core/src/test/java/org/springframework/security/core/session/SessionRegistryImplTests.java b/core/src/test/java/org/springframework/security/core/session/SessionRegistryImplTests.java index 14a9e847ee..ecd563b946 100644 --- a/core/src/test/java/org/springframework/security/core/session/SessionRegistryImplTests.java +++ b/core/src/test/java/org/springframework/security/core/session/SessionRegistryImplTests.java @@ -19,8 +19,8 @@ package org.springframework.security.core.session; import java.util.Date; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.core.context.SecurityContext; @@ -35,7 +35,7 @@ public class SessionRegistryImplTests { private SessionRegistryImpl sessionRegistry; - @Before + @BeforeEach public void setUp() { this.sessionRegistry = new SessionRegistryImpl(); } diff --git a/core/src/test/java/org/springframework/security/core/token/DefaultTokenTests.java b/core/src/test/java/org/springframework/security/core/token/DefaultTokenTests.java index 4c41fed858..d3274af3ab 100644 --- a/core/src/test/java/org/springframework/security/core/token/DefaultTokenTests.java +++ b/core/src/test/java/org/springframework/security/core/token/DefaultTokenTests.java @@ -18,7 +18,7 @@ package org.springframework.security.core.token; import java.util.Date; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/core/src/test/java/org/springframework/security/core/token/KeyBasedPersistenceTokenServiceTests.java b/core/src/test/java/org/springframework/security/core/token/KeyBasedPersistenceTokenServiceTests.java index ed092bcacb..4863162feb 100644 --- a/core/src/test/java/org/springframework/security/core/token/KeyBasedPersistenceTokenServiceTests.java +++ b/core/src/test/java/org/springframework/security/core/token/KeyBasedPersistenceTokenServiceTests.java @@ -19,7 +19,7 @@ package org.springframework.security.core.token; import java.security.SecureRandom; import java.util.Date; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/core/src/test/java/org/springframework/security/core/token/SecureRandomFactoryBeanTests.java b/core/src/test/java/org/springframework/security/core/token/SecureRandomFactoryBeanTests.java index b3ab4cc491..7f8663b48b 100644 --- a/core/src/test/java/org/springframework/security/core/token/SecureRandomFactoryBeanTests.java +++ b/core/src/test/java/org/springframework/security/core/token/SecureRandomFactoryBeanTests.java @@ -18,7 +18,7 @@ package org.springframework.security.core.token; import java.security.SecureRandom; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; diff --git a/core/src/test/java/org/springframework/security/core/userdetails/MapReactiveUserDetailsServiceTests.java b/core/src/test/java/org/springframework/security/core/userdetails/MapReactiveUserDetailsServiceTests.java index 75abac7178..223671a265 100644 --- a/core/src/test/java/org/springframework/security/core/userdetails/MapReactiveUserDetailsServiceTests.java +++ b/core/src/test/java/org/springframework/security/core/userdetails/MapReactiveUserDetailsServiceTests.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import static org.assertj.core.api.Assertions.assertThat; diff --git a/core/src/test/java/org/springframework/security/core/userdetails/UserDetailsByNameServiceWrapperTests.java b/core/src/test/java/org/springframework/security/core/userdetails/UserDetailsByNameServiceWrapperTests.java index f23125d2b7..9dc455e1f1 100644 --- a/core/src/test/java/org/springframework/security/core/userdetails/UserDetailsByNameServiceWrapperTests.java +++ b/core/src/test/java/org/springframework/security/core/userdetails/UserDetailsByNameServiceWrapperTests.java @@ -16,7 +16,7 @@ package org.springframework.security.core.userdetails; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/core/src/test/java/org/springframework/security/core/userdetails/UserTests.java b/core/src/test/java/org/springframework/security/core/userdetails/UserTests.java index d56d39c313..8c8855718f 100644 --- a/core/src/test/java/org/springframework/security/core/userdetails/UserTests.java +++ b/core/src/test/java/org/springframework/security/core/userdetails/UserTests.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Set; import java.util.function.Function; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/core/src/test/java/org/springframework/security/core/userdetails/cache/EhCacheBasedUserCacheTests.java b/core/src/test/java/org/springframework/security/core/userdetails/cache/EhCacheBasedUserCacheTests.java index 28a828e21b..907290dd63 100644 --- a/core/src/test/java/org/springframework/security/core/userdetails/cache/EhCacheBasedUserCacheTests.java +++ b/core/src/test/java/org/springframework/security/core/userdetails/cache/EhCacheBasedUserCacheTests.java @@ -19,9 +19,9 @@ package org.springframework.security.core.userdetails.cache; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Ehcache; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.userdetails.User; @@ -38,13 +38,13 @@ public class EhCacheBasedUserCacheTests { private static CacheManager cacheManager; - @BeforeClass + @BeforeAll public static void initCacheManaer() { cacheManager = CacheManager.create(); cacheManager.addCache(new Cache("ehcacheusercachetests", 500, false, false, 30, 30)); } - @AfterClass + @AfterAll public static void shutdownCacheManager() { cacheManager.removalAll(); cacheManager.shutdown(); diff --git a/core/src/test/java/org/springframework/security/core/userdetails/cache/NullUserCacheTests.java b/core/src/test/java/org/springframework/security/core/userdetails/cache/NullUserCacheTests.java index 4b626f5bc7..589800195d 100644 --- a/core/src/test/java/org/springframework/security/core/userdetails/cache/NullUserCacheTests.java +++ b/core/src/test/java/org/springframework/security/core/userdetails/cache/NullUserCacheTests.java @@ -16,7 +16,7 @@ package org.springframework.security.core.userdetails.cache; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.userdetails.User; diff --git a/core/src/test/java/org/springframework/security/core/userdetails/cache/SpringCacheBasedUserCacheTests.java b/core/src/test/java/org/springframework/security/core/userdetails/cache/SpringCacheBasedUserCacheTests.java index c42020a073..4958a83bb9 100644 --- a/core/src/test/java/org/springframework/security/core/userdetails/cache/SpringCacheBasedUserCacheTests.java +++ b/core/src/test/java/org/springframework/security/core/userdetails/cache/SpringCacheBasedUserCacheTests.java @@ -16,9 +16,9 @@ package org.springframework.security.core.userdetails.cache; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; @@ -41,13 +41,13 @@ public class SpringCacheBasedUserCacheTests { private static CacheManager cacheManager; - @BeforeClass + @BeforeAll public static void initCacheManaer() { cacheManager = new ConcurrentMapCacheManager(); cacheManager.getCache("springbasedusercachetests"); } - @AfterClass + @AfterAll public static void shutdownCacheManager() { } diff --git a/core/src/test/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImplTests.java b/core/src/test/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImplTests.java index b1d4d559a1..6fd1a41b15 100644 --- a/core/src/test/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImplTests.java +++ b/core/src/test/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImplTests.java @@ -16,7 +16,7 @@ package org.springframework.security.core.userdetails.jdbc; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.MessageSource; import org.springframework.security.PopulatedDatabase; diff --git a/core/src/test/java/org/springframework/security/core/userdetails/memory/UserAttributeEditorTests.java b/core/src/test/java/org/springframework/security/core/userdetails/memory/UserAttributeEditorTests.java index 1d700855e8..7dcd835916 100644 --- a/core/src/test/java/org/springframework/security/core/userdetails/memory/UserAttributeEditorTests.java +++ b/core/src/test/java/org/springframework/security/core/userdetails/memory/UserAttributeEditorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.core.userdetails.memory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/core/src/test/java/org/springframework/security/jackson2/AbstractMixinTests.java b/core/src/test/java/org/springframework/security/jackson2/AbstractMixinTests.java index a29801bd5a..c68e952460 100644 --- a/core/src/test/java/org/springframework/security/jackson2/AbstractMixinTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/AbstractMixinTests.java @@ -17,7 +17,7 @@ package org.springframework.security.jackson2; import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.userdetails.User; @@ -30,7 +30,7 @@ public abstract class AbstractMixinTests { protected ObjectMapper mapper; - @Before + @BeforeEach public void setup() { this.mapper = new ObjectMapper(); ClassLoader loader = getClass().getClassLoader(); diff --git a/core/src/test/java/org/springframework/security/jackson2/AnonymousAuthenticationTokenMixinTests.java b/core/src/test/java/org/springframework/security/jackson2/AnonymousAuthenticationTokenMixinTests.java index 387f1576a1..b9ade527a2 100644 --- a/core/src/test/java/org/springframework/security/jackson2/AnonymousAuthenticationTokenMixinTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/AnonymousAuthenticationTokenMixinTests.java @@ -21,7 +21,7 @@ import java.io.IOException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.authentication.AnonymousAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/jackson2/BadCredentialsExceptionMixinTests.java b/core/src/test/java/org/springframework/security/jackson2/BadCredentialsExceptionMixinTests.java index 91dbb6750e..a072940401 100644 --- a/core/src/test/java/org/springframework/security/jackson2/BadCredentialsExceptionMixinTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/BadCredentialsExceptionMixinTests.java @@ -20,7 +20,7 @@ import java.io.IOException; import com.fasterxml.jackson.core.JsonProcessingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.authentication.BadCredentialsException; diff --git a/core/src/test/java/org/springframework/security/jackson2/RememberMeAuthenticationTokenMixinTests.java b/core/src/test/java/org/springframework/security/jackson2/RememberMeAuthenticationTokenMixinTests.java index 9d5a1a6fdd..09b01ef03b 100644 --- a/core/src/test/java/org/springframework/security/jackson2/RememberMeAuthenticationTokenMixinTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/RememberMeAuthenticationTokenMixinTests.java @@ -21,7 +21,7 @@ import java.util.Collections; import com.fasterxml.jackson.core.JsonProcessingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.authentication.RememberMeAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/jackson2/SecurityContextMixinTests.java b/core/src/test/java/org/springframework/security/jackson2/SecurityContextMixinTests.java index 8f2806079f..ced0820357 100644 --- a/core/src/test/java/org/springframework/security/jackson2/SecurityContextMixinTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/SecurityContextMixinTests.java @@ -22,7 +22,7 @@ import java.util.Collections; import com.fasterxml.jackson.core.JsonProcessingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/jackson2/SecurityJackson2ModulesTests.java b/core/src/test/java/org/springframework/security/jackson2/SecurityJackson2ModulesTests.java index cbbbddc130..80803ca2cd 100644 --- a/core/src/test/java/org/springframework/security/jackson2/SecurityJackson2ModulesTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/SecurityJackson2ModulesTests.java @@ -28,8 +28,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreType; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -42,7 +42,7 @@ public class SecurityJackson2ModulesTests { private ObjectMapper mapper; - @Before + @BeforeEach public void setup() { this.mapper = new ObjectMapper(); SecurityJackson2Modules.enableDefaultTyping(this.mapper); diff --git a/core/src/test/java/org/springframework/security/jackson2/SimpleGrantedAuthorityMixinTests.java b/core/src/test/java/org/springframework/security/jackson2/SimpleGrantedAuthorityMixinTests.java index e146a827e9..1e26b642be 100644 --- a/core/src/test/java/org/springframework/security/jackson2/SimpleGrantedAuthorityMixinTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/SimpleGrantedAuthorityMixinTests.java @@ -21,7 +21,7 @@ import java.io.IOException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.core.authority.SimpleGrantedAuthority; diff --git a/core/src/test/java/org/springframework/security/jackson2/UserDeserializerTests.java b/core/src/test/java/org/springframework/security/jackson2/UserDeserializerTests.java index 0f08439621..c2820b8451 100644 --- a/core/src/test/java/org/springframework/security/jackson2/UserDeserializerTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/UserDeserializerTests.java @@ -24,7 +24,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.core.GrantedAuthority; diff --git a/core/src/test/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenMixinTests.java b/core/src/test/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenMixinTests.java index 130c9ea0ab..f28bfae6e9 100644 --- a/core/src/test/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenMixinTests.java +++ b/core/src/test/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenMixinTests.java @@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude.Value; import com.fasterxml.jackson.core.JsonProcessingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/core/src/test/java/org/springframework/security/provisioning/InMemoryUserDetailsManagerTests.java b/core/src/test/java/org/springframework/security/provisioning/InMemoryUserDetailsManagerTests.java index 26ad05a4e0..5879565541 100644 --- a/core/src/test/java/org/springframework/security/provisioning/InMemoryUserDetailsManagerTests.java +++ b/core/src/test/java/org/springframework/security/provisioning/InMemoryUserDetailsManagerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.provisioning; import java.util.Properties; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.userdetails.PasswordEncodedUser; import org.springframework.security.core.userdetails.User; diff --git a/core/src/test/java/org/springframework/security/provisioning/JdbcUserDetailsManagerTests.java b/core/src/test/java/org/springframework/security/provisioning/JdbcUserDetailsManagerTests.java index b24123905e..4192377632 100644 --- a/core/src/test/java/org/springframework/security/provisioning/JdbcUserDetailsManagerTests.java +++ b/core/src/test/java/org/springframework/security/provisioning/JdbcUserDetailsManagerTests.java @@ -21,11 +21,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.security.PopulatedDatabase; @@ -71,18 +71,18 @@ public class JdbcUserDetailsManagerTests { private JdbcTemplate template; - @BeforeClass + @BeforeAll public static void createDataSource() { dataSource = new TestDataSource("jdbcusermgrtest"); } - @AfterClass + @AfterAll public static void clearDataSource() throws Exception { dataSource.destroy(); dataSource = null; } - @Before + @BeforeEach public void initializeManagerAndCreateTables() { this.manager = new JdbcUserDetailsManager(); this.cache = new MockUserCache(); @@ -106,7 +106,7 @@ public class JdbcUserDetailsManagerTests { PopulatedDatabase.insertGroupData(this.template); } - @After + @AfterEach public void dropTablesAndClearContext() { this.template.execute("drop table authorities"); this.template.execute("drop table users"); diff --git a/core/src/test/java/org/springframework/security/scheduling/AbstractSecurityContextSchedulingTaskExecutorTests.java b/core/src/test/java/org/springframework/security/scheduling/AbstractSecurityContextSchedulingTaskExecutorTests.java index 635451cbef..0514e4644e 100644 --- a/core/src/test/java/org/springframework/security/scheduling/AbstractSecurityContextSchedulingTaskExecutorTests.java +++ b/core/src/test/java/org/springframework/security/scheduling/AbstractSecurityContextSchedulingTaskExecutorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.scheduling; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.springframework.scheduling.SchedulingTaskExecutor; diff --git a/core/src/test/java/org/springframework/security/scheduling/CurrentSecurityContextSchedulingTaskExecutorTests.java b/core/src/test/java/org/springframework/security/scheduling/CurrentSecurityContextSchedulingTaskExecutorTests.java index ed92af6880..8963d8af1a 100644 --- a/core/src/test/java/org/springframework/security/scheduling/CurrentSecurityContextSchedulingTaskExecutorTests.java +++ b/core/src/test/java/org/springframework/security/scheduling/CurrentSecurityContextSchedulingTaskExecutorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.scheduling; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -31,7 +31,7 @@ import org.springframework.security.core.context.SecurityContext; public class CurrentSecurityContextSchedulingTaskExecutorTests extends AbstractSecurityContextSchedulingTaskExecutorTests { - @Before + @BeforeEach public void setUp() throws Exception { currentSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskSchedulerTests.java b/core/src/test/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskSchedulerTests.java index 7c88d9a642..5eb8c77220 100644 --- a/core/src/test/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskSchedulerTests.java +++ b/core/src/test/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskSchedulerTests.java @@ -20,9 +20,9 @@ import java.time.Instant; import java.util.Date; import java.util.concurrent.ScheduledFuture; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -65,7 +65,7 @@ public class DelegatingSecurityContextTaskSchedulerTests { private DelegatingSecurityContextTaskScheduler delegatingSecurityContextTaskScheduler; - @Before + @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); this.originalSecurityContext = SecurityContextHolder.createEmptyContext(); @@ -73,7 +73,7 @@ public class DelegatingSecurityContextTaskSchedulerTests { this.securityContext); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); this.delegatingSecurityContextTaskScheduler = null; diff --git a/core/src/test/java/org/springframework/security/scheduling/ExplicitSecurityContextSchedulingTaskExecutorTests.java b/core/src/test/java/org/springframework/security/scheduling/ExplicitSecurityContextSchedulingTaskExecutorTests.java index c66d291527..c65666c866 100644 --- a/core/src/test/java/org/springframework/security/scheduling/ExplicitSecurityContextSchedulingTaskExecutorTests.java +++ b/core/src/test/java/org/springframework/security/scheduling/ExplicitSecurityContextSchedulingTaskExecutorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.scheduling; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -31,7 +31,7 @@ import org.springframework.security.core.context.SecurityContext; public class ExplicitSecurityContextSchedulingTaskExecutorTests extends AbstractSecurityContextSchedulingTaskExecutorTests { - @Before + @BeforeEach public void setUp() throws Exception { explicitSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/task/AbstractDelegatingSecurityContextAsyncTaskExecutorTests.java b/core/src/test/java/org/springframework/security/task/AbstractDelegatingSecurityContextAsyncTaskExecutorTests.java index 4558c6a9cb..9ae326b090 100644 --- a/core/src/test/java/org/springframework/security/task/AbstractDelegatingSecurityContextAsyncTaskExecutorTests.java +++ b/core/src/test/java/org/springframework/security/task/AbstractDelegatingSecurityContextAsyncTaskExecutorTests.java @@ -16,8 +16,8 @@ package org.springframework.security.task; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.springframework.core.task.AsyncTaskExecutor; @@ -43,7 +43,7 @@ public abstract class AbstractDelegatingSecurityContextAsyncTaskExecutorTests private DelegatingSecurityContextAsyncTaskExecutor executor; - @Before + @BeforeEach public final void setUpExecutor() { this.executor = create(); } diff --git a/core/src/test/java/org/springframework/security/task/CurrentDelegatingSecurityContextAsyncTaskExecutorTests.java b/core/src/test/java/org/springframework/security/task/CurrentDelegatingSecurityContextAsyncTaskExecutorTests.java index a4fe729c0c..4adde808fe 100644 --- a/core/src/test/java/org/springframework/security/task/CurrentDelegatingSecurityContextAsyncTaskExecutorTests.java +++ b/core/src/test/java/org/springframework/security/task/CurrentDelegatingSecurityContextAsyncTaskExecutorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.task; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -31,7 +31,7 @@ import org.springframework.security.core.context.SecurityContext; public class CurrentDelegatingSecurityContextAsyncTaskExecutorTests extends AbstractDelegatingSecurityContextAsyncTaskExecutorTests { - @Before + @BeforeEach public void setUp() throws Exception { currentSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/task/CurrentDelegatingSecurityContextTaskExecutorTests.java b/core/src/test/java/org/springframework/security/task/CurrentDelegatingSecurityContextTaskExecutorTests.java index 04ffbc3f6c..16b3258dd8 100644 --- a/core/src/test/java/org/springframework/security/task/CurrentDelegatingSecurityContextTaskExecutorTests.java +++ b/core/src/test/java/org/springframework/security/task/CurrentDelegatingSecurityContextTaskExecutorTests.java @@ -18,7 +18,7 @@ package org.springframework.security.task; import java.util.concurrent.Executor; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; import org.springframework.core.task.TaskExecutor; @@ -39,7 +39,7 @@ public class CurrentDelegatingSecurityContextTaskExecutorTests extends AbstractD @Mock private TaskExecutor taskExecutorDelegate; - @Before + @BeforeEach public void setUp() throws Exception { currentSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/task/ExplicitDelegatingSecurityContextAsyncTaskExecutorTests.java b/core/src/test/java/org/springframework/security/task/ExplicitDelegatingSecurityContextAsyncTaskExecutorTests.java index 27608241f8..9f136645fa 100644 --- a/core/src/test/java/org/springframework/security/task/ExplicitDelegatingSecurityContextAsyncTaskExecutorTests.java +++ b/core/src/test/java/org/springframework/security/task/ExplicitDelegatingSecurityContextAsyncTaskExecutorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.task; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.core.context.SecurityContext; @@ -31,7 +31,7 @@ import org.springframework.security.core.context.SecurityContext; public class ExplicitDelegatingSecurityContextAsyncTaskExecutorTests extends AbstractDelegatingSecurityContextAsyncTaskExecutorTests { - @Before + @BeforeEach public void setUp() throws Exception { explicitSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/task/ExplicitDelegatingSecurityContextTaskExecutorTests.java b/core/src/test/java/org/springframework/security/task/ExplicitDelegatingSecurityContextTaskExecutorTests.java index 34bfd196cf..f8e045e08b 100644 --- a/core/src/test/java/org/springframework/security/task/ExplicitDelegatingSecurityContextTaskExecutorTests.java +++ b/core/src/test/java/org/springframework/security/task/ExplicitDelegatingSecurityContextTaskExecutorTests.java @@ -18,7 +18,7 @@ package org.springframework.security.task; import java.util.concurrent.Executor; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; import org.springframework.core.task.TaskExecutor; @@ -39,7 +39,7 @@ public class ExplicitDelegatingSecurityContextTaskExecutorTests extends Abstract @Mock private TaskExecutor taskExecutorDelegate; - @Before + @BeforeEach public void setUp() throws Exception { explicitSecurityContextSetup(); } diff --git a/core/src/test/java/org/springframework/security/util/FieldUtilsTests.java b/core/src/test/java/org/springframework/security/util/FieldUtilsTests.java index 9369b93eca..ecd4c6e0a7 100644 --- a/core/src/test/java/org/springframework/security/util/FieldUtilsTests.java +++ b/core/src/test/java/org/springframework/security/util/FieldUtilsTests.java @@ -16,7 +16,7 @@ package org.springframework.security.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; diff --git a/core/src/test/java/org/springframework/security/util/InMemoryResourceTests.java b/core/src/test/java/org/springframework/security/util/InMemoryResourceTests.java index 23edf7030a..8d3f865e58 100644 --- a/core/src/test/java/org/springframework/security/util/InMemoryResourceTests.java +++ b/core/src/test/java/org/springframework/security/util/InMemoryResourceTests.java @@ -16,7 +16,7 @@ package org.springframework.security.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/core/src/test/java/org/springframework/security/util/MethodInvocationUtilsTests.java b/core/src/test/java/org/springframework/security/util/MethodInvocationUtilsTests.java index 3901e63ec1..cd094dacad 100644 --- a/core/src/test/java/org/springframework/security/util/MethodInvocationUtilsTests.java +++ b/core/src/test/java/org/springframework/security/util/MethodInvocationUtilsTests.java @@ -19,7 +19,7 @@ package org.springframework.security.util; import java.io.Serializable; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.aop.framework.AdvisedSupport; import org.springframework.security.access.annotation.BusinessServiceImpl; diff --git a/crypto/src/test/java/org/springframework/security/crypto/argon2/Argon2EncodingUtilsTests.java b/crypto/src/test/java/org/springframework/security/crypto/argon2/Argon2EncodingUtilsTests.java index f69b9d479d..d87ca46ec4 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/argon2/Argon2EncodingUtilsTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/argon2/Argon2EncodingUtilsTests.java @@ -19,7 +19,7 @@ package org.springframework.security.crypto.argon2; import java.util.Base64; import org.bouncycastle.crypto.params.Argon2Parameters; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/crypto/src/test/java/org/springframework/security/crypto/argon2/Argon2PasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/argon2/Argon2PasswordEncoderTests.java index 72eda1f817..6aaa690491 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/argon2/Argon2PasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/argon2/Argon2PasswordEncoderTests.java @@ -19,11 +19,11 @@ package org.springframework.security.crypto.argon2; import java.lang.reflect.Field; import java.util.Arrays; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.crypto.keygen.BytesKeyGenerator; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException /** * @author Simeon Macke */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class Argon2PasswordEncoderTests { @Mock diff --git a/crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptPasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptPasswordEncoderTests.java index 9039dc9657..19764dcc9e 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptPasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptPasswordEncoderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.crypto.bcrypt; import java.security.SecureRandom; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptTests.java b/crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptTests.java index 2e11b0fe4e..6796df440e 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/bcrypt/BCryptTests.java @@ -17,8 +17,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -58,7 +58,7 @@ public class BCryptTests { private static List> testObjectsByteArray; - @BeforeClass + @BeforeAll public static void setupTestObjects() { testObjectsString = new ArrayList<>(); testObjectsString.add(new TestObject<>("", "$2a$06$DCq7YPn5Rq63x1Lad4cll.", diff --git a/crypto/src/test/java/org/springframework/security/crypto/codec/Base64Tests.java b/crypto/src/test/java/org/springframework/security/crypto/codec/Base64Tests.java index 40017d5279..e53eddc564 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/codec/Base64Tests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/codec/Base64Tests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.codec; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/crypto/src/test/java/org/springframework/security/crypto/codec/HexTests.java b/crypto/src/test/java/org/springframework/security/crypto/codec/HexTests.java index 9c31fcd753..d3b73f6b52 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/codec/HexTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/codec/HexTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.codec; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/crypto/src/test/java/org/springframework/security/crypto/codec/Utf8Tests.java b/crypto/src/test/java/org/springframework/security/crypto/codec/Utf8Tests.java index 4c1b202df8..c158af0ca3 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/codec/Utf8Tests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/codec/Utf8Tests.java @@ -18,7 +18,7 @@ package org.springframework.security.crypto.codec; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/crypto/src/test/java/org/springframework/security/crypto/encrypt/AesBytesEncryptorTests.java b/crypto/src/test/java/org/springframework/security/crypto/encrypt/AesBytesEncryptorTests.java index d806b028cb..97179f7572 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/encrypt/AesBytesEncryptorTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/encrypt/AesBytesEncryptorTests.java @@ -19,8 +19,8 @@ package org.springframework.security.crypto.encrypt; import javax.crypto.SecretKey; import javax.crypto.spec.PBEKeySpec; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.codec.Hex; import org.springframework.security.crypto.encrypt.AesBytesEncryptor.CipherAlgorithm; @@ -44,7 +44,7 @@ public class AesBytesEncryptorTests { private BytesKeyGenerator generator; - @Before + @BeforeEach public void setUp() { this.generator = mock(BytesKeyGenerator.class); given(this.generator.generateKey()).willReturn(Hex.decode("4b0febebd439db7ca77153cb254520c3")); diff --git a/crypto/src/test/java/org/springframework/security/crypto/encrypt/BouncyCastleAesBytesEncryptorEquivalencyTests.java b/crypto/src/test/java/org/springframework/security/crypto/encrypt/BouncyCastleAesBytesEncryptorEquivalencyTests.java index 44506004d1..198ffd8f04 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/encrypt/BouncyCastleAesBytesEncryptorEquivalencyTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/encrypt/BouncyCastleAesBytesEncryptorEquivalencyTests.java @@ -20,9 +20,9 @@ import java.security.SecureRandom; import java.util.Random; import java.util.UUID; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.codec.Hex; import org.springframework.security.crypto.encrypt.AesBytesEncryptor.CipherAlgorithm; @@ -39,7 +39,7 @@ public class BouncyCastleAesBytesEncryptorEquivalencyTests { private SecureRandom secureRandom = new SecureRandom(); - @Before + @BeforeEach public void setup() { // generate random password, salt, and test data this.password = UUID.randomUUID().toString(); @@ -96,11 +96,11 @@ public class BouncyCastleAesBytesEncryptorEquivalencyTests { // and can decrypt back to the original input byte[] leftEncrypted = left.encrypt(this.testData); byte[] rightEncrypted = right.encrypt(this.testData); - Assert.assertArrayEquals(leftEncrypted, rightEncrypted); + Assertions.assertArrayEquals(leftEncrypted, rightEncrypted); byte[] leftDecrypted = left.decrypt(leftEncrypted); byte[] rightDecrypted = right.decrypt(rightEncrypted); - Assert.assertArrayEquals(this.testData, leftDecrypted); - Assert.assertArrayEquals(this.testData, rightDecrypted); + Assertions.assertArrayEquals(this.testData, leftDecrypted); + Assertions.assertArrayEquals(this.testData, rightDecrypted); } } @@ -114,8 +114,8 @@ public class BouncyCastleAesBytesEncryptorEquivalencyTests { byte[] rightEncrypted = right.encrypt(this.testData); byte[] leftDecrypted = left.decrypt(rightEncrypted); byte[] rightDecrypted = right.decrypt(leftEncrypted); - Assert.assertArrayEquals(this.testData, leftDecrypted); - Assert.assertArrayEquals(this.testData, rightDecrypted); + Assertions.assertArrayEquals(this.testData, leftDecrypted); + Assertions.assertArrayEquals(this.testData, rightDecrypted); } } diff --git a/crypto/src/test/java/org/springframework/security/crypto/encrypt/BouncyCastleAesBytesEncryptorTests.java b/crypto/src/test/java/org/springframework/security/crypto/encrypt/BouncyCastleAesBytesEncryptorTests.java index 6286b2767d..2b5ec62348 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/encrypt/BouncyCastleAesBytesEncryptorTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/encrypt/BouncyCastleAesBytesEncryptorTests.java @@ -20,9 +20,9 @@ import java.security.SecureRandom; import java.util.UUID; import org.bouncycastle.util.Arrays; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.codec.Hex; import org.springframework.security.crypto.keygen.KeyGenerators; @@ -37,7 +37,7 @@ public class BouncyCastleAesBytesEncryptorTests { private String salt; - @Before + @BeforeEach public void setup() { // generate random password, salt, and test data SecureRandom secureRandom = new SecureRandom(); @@ -64,11 +64,11 @@ public class BouncyCastleAesBytesEncryptorTests { private void generatesDifferentCipherTexts(BytesEncryptor bcEncryptor) { byte[] encrypted1 = bcEncryptor.encrypt(this.testData); byte[] encrypted2 = bcEncryptor.encrypt(this.testData); - Assert.assertFalse(Arrays.areEqual(encrypted1, encrypted2)); + Assertions.assertFalse(Arrays.areEqual(encrypted1, encrypted2)); byte[] decrypted1 = bcEncryptor.decrypt(encrypted1); byte[] decrypted2 = bcEncryptor.decrypt(encrypted2); - Assert.assertArrayEquals(this.testData, decrypted1); - Assert.assertArrayEquals(this.testData, decrypted2); + Assertions.assertArrayEquals(this.testData, decrypted1); + Assertions.assertArrayEquals(this.testData, decrypted2); } @Test diff --git a/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java b/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java index 3fca2601c8..4ff573470e 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java +++ b/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java @@ -21,8 +21,8 @@ import java.security.NoSuchAlgorithmException; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; -import org.junit.Assume; import org.junit.AssumptionViolatedException; +import org.junit.jupiter.api.Assumptions; import org.springframework.security.crypto.encrypt.AesBytesEncryptor.CipherAlgorithm; @@ -51,7 +51,7 @@ public final class CryptoAssumptions { catch (NoSuchPaddingException ex) { throw new AssumptionViolatedException(cipherAlgorithm + " padding not available, skipping test", ex); } - Assume.assumeTrue("AES key length of 256 not allowed, skipping test", aes256Available); + Assumptions.assumeTrue(aes256Available, "AES key length of 256 not allowed, skipping test"); } } diff --git a/crypto/src/test/java/org/springframework/security/crypto/encrypt/EncryptorsTests.java b/crypto/src/test/java/org/springframework/security/crypto/encrypt/EncryptorsTests.java index 470cc796f7..4a4fd72a95 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/encrypt/EncryptorsTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/encrypt/EncryptorsTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.encrypt; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/crypto/src/test/java/org/springframework/security/crypto/factory/PasswordEncoderFactoriesTests.java b/crypto/src/test/java/org/springframework/security/crypto/factory/PasswordEncoderFactoriesTests.java index 89143fae4e..ab2ca94a94 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/factory/PasswordEncoderFactoriesTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/factory/PasswordEncoderFactoriesTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.factory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.password.PasswordEncoder; diff --git a/crypto/src/test/java/org/springframework/security/crypto/keygen/Base64StringKeyGeneratorTests.java b/crypto/src/test/java/org/springframework/security/crypto/keygen/Base64StringKeyGeneratorTests.java index c451b4954b..4590b67683 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/keygen/Base64StringKeyGeneratorTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/keygen/Base64StringKeyGeneratorTests.java @@ -18,7 +18,7 @@ package org.springframework.security.crypto.keygen; import java.util.Base64; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/crypto/src/test/java/org/springframework/security/crypto/keygen/KeyGeneratorsTests.java b/crypto/src/test/java/org/springframework/security/crypto/keygen/KeyGeneratorsTests.java index f0ec884464..517a01fb04 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/keygen/KeyGeneratorsTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/keygen/KeyGeneratorsTests.java @@ -18,7 +18,7 @@ package org.springframework.security.crypto.keygen; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.codec.Hex; 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 a04cec7c2f..a67ae334de 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 @@ -20,11 +20,11 @@ import java.util.HashMap; import java.util.Hashtable; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -38,7 +38,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Michael Simons * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingPasswordEncoderTests { @Mock @@ -64,7 +64,7 @@ public class DelegatingPasswordEncoderTests { private DelegatingPasswordEncoder passwordEncoder; - @Before + @BeforeEach public void setup() { this.delegates = new HashMap<>(); this.delegates.put(this.bcryptId, this.bcrypt); diff --git a/crypto/src/test/java/org/springframework/security/crypto/password/DigesterTests.java b/crypto/src/test/java/org/springframework/security/crypto/password/DigesterTests.java index b5a2c24351..ebeb753fc8 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/password/DigesterTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/password/DigesterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.password; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.codec.Hex; import org.springframework.security.crypto.codec.Utf8; diff --git a/crypto/src/test/java/org/springframework/security/crypto/password/LdapShaPasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/password/LdapShaPasswordEncoderTests.java index a24ae4be91..446b0fc846 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/password/LdapShaPasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/password/LdapShaPasswordEncoderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.password; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.keygen.KeyGenerators; diff --git a/crypto/src/test/java/org/springframework/security/crypto/password/Md4PasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/password/Md4PasswordEncoderTests.java index a1de26c6c3..fa4bbfd202 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/password/Md4PasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/password/Md4PasswordEncoderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.password; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/crypto/src/test/java/org/springframework/security/crypto/password/MessageDigestPasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/password/MessageDigestPasswordEncoderTests.java index a08ea0d77b..ec25894a2d 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/password/MessageDigestPasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/password/MessageDigestPasswordEncoderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.password; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; diff --git a/crypto/src/test/java/org/springframework/security/crypto/password/PasswordEncoderUtilsTests.java b/crypto/src/test/java/org/springframework/security/crypto/password/PasswordEncoderUtilsTests.java index beeadc065a..0beaa5aa9f 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/password/PasswordEncoderUtilsTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/password/PasswordEncoderUtilsTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.password; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/crypto/src/test/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoderTests.java index 3ed919fa75..1a8ea46f74 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.crypto.password; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.codec.Hex; import org.springframework.security.crypto.keygen.KeyGenerators; diff --git a/crypto/src/test/java/org/springframework/security/crypto/password/StandardPasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/password/StandardPasswordEncoderTests.java index 0c89dbcfd5..c86c351a65 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/password/StandardPasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/password/StandardPasswordEncoderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.password; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/crypto/src/test/java/org/springframework/security/crypto/scrypt/SCryptPasswordEncoderTests.java b/crypto/src/test/java/org/springframework/security/crypto/scrypt/SCryptPasswordEncoderTests.java index 3c4eb04a9b..ad43ffc5e2 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/scrypt/SCryptPasswordEncoderTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/scrypt/SCryptPasswordEncoderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.crypto.scrypt; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/crypto/src/test/java/org/springframework/security/crypto/util/EncodingUtilsTests.java b/crypto/src/test/java/org/springframework/security/crypto/util/EncodingUtilsTests.java index cc233a211e..14ccf28fbc 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/util/EncodingUtilsTests.java +++ b/crypto/src/test/java/org/springframework/security/crypto/util/EncodingUtilsTests.java @@ -18,7 +18,7 @@ package org.springframework.security.crypto.util; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.crypto.codec.Hex; diff --git a/data/src/test/java/org/springframework/security/data/repository/query/SecurityEvaluationContextExtensionTests.java b/data/src/test/java/org/springframework/security/data/repository/query/SecurityEvaluationContextExtensionTests.java index 5283ee7759..a890a463af 100644 --- a/data/src/test/java/org/springframework/security/data/repository/query/SecurityEvaluationContextExtensionTests.java +++ b/data/src/test/java/org/springframework/security/data/repository/query/SecurityEvaluationContextExtensionTests.java @@ -16,9 +16,9 @@ package org.springframework.security.data.repository.query; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.access.expression.SecurityExpressionRoot; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -31,12 +31,12 @@ public class SecurityEvaluationContextExtensionTests { SecurityEvaluationContextExtension securityExtension; - @Before + @BeforeEach public void setup() { this.securityExtension = new SecurityEvaluationContextExtension(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/itest/context/src/integration-test/java/org/springframework/security/integration/HttpNamespaceWithMultipleInterceptorsTests.java b/itest/context/src/integration-test/java/org/springframework/security/integration/HttpNamespaceWithMultipleInterceptorsTests.java index f4f42b4c4a..8f52555cdb 100644 --- a/itest/context/src/integration-test/java/org/springframework/security/integration/HttpNamespaceWithMultipleInterceptorsTests.java +++ b/itest/context/src/integration-test/java/org/springframework/security/integration/HttpNamespaceWithMultipleInterceptorsTests.java @@ -18,8 +18,8 @@ package org.springframework.security.integration; import javax.servlet.http.HttpSession; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockFilterChain; @@ -31,12 +31,12 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.context.HttpSessionSecurityContextRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @ContextConfiguration(locations = { "/http-extra-fsi-app-context.xml" }) -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class HttpNamespaceWithMultipleInterceptorsTests { @Autowired diff --git a/itest/context/src/integration-test/java/org/springframework/security/integration/HttpPathParameterStrippingTests.java b/itest/context/src/integration-test/java/org/springframework/security/integration/HttpPathParameterStrippingTests.java index 9f7770003e..7ddef56172 100644 --- a/itest/context/src/integration-test/java/org/springframework/security/integration/HttpPathParameterStrippingTests.java +++ b/itest/context/src/integration-test/java/org/springframework/security/integration/HttpPathParameterStrippingTests.java @@ -18,8 +18,8 @@ package org.springframework.security.integration; import javax.servlet.http.HttpSession; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockFilterChain; @@ -32,12 +32,12 @@ import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.context.HttpSessionSecurityContextRepository; import org.springframework.security.web.firewall.RequestRejectedException; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @ContextConfiguration(locations = { "/http-path-param-stripping-app-context.xml" }) -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class HttpPathParameterStrippingTests { @Autowired diff --git a/itest/context/src/integration-test/java/org/springframework/security/integration/MultiAnnotationTests.java b/itest/context/src/integration-test/java/org/springframework/security/integration/MultiAnnotationTests.java index 50813ce4aa..e2be13bba8 100644 --- a/itest/context/src/integration-test/java/org/springframework/security/integration/MultiAnnotationTests.java +++ b/itest/context/src/integration-test/java/org/springframework/security/integration/MultiAnnotationTests.java @@ -16,10 +16,10 @@ package org.springframework.security.integration; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; @@ -29,7 +29,7 @@ import org.springframework.security.integration.multiannotation.MultiAnnotationS import org.springframework.security.integration.multiannotation.PreAuthorizeService; import org.springframework.security.integration.multiannotation.SecuredService; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Luke Taylor */ @ContextConfiguration(locations = { "/multi-sec-annotation-app-context.xml" }) -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class MultiAnnotationTests { private final TestingAuthenticationToken joe_a = new TestingAuthenticationToken("joe", "pass", "ROLE_A"); @@ -53,8 +53,8 @@ public class MultiAnnotationTests { @Autowired SecuredService secService; - @After - @Before + @AfterEach + @BeforeEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/itest/context/src/integration-test/java/org/springframework/security/integration/SEC933ApplicationContextTests.java b/itest/context/src/integration-test/java/org/springframework/security/integration/SEC933ApplicationContextTests.java index dd9fc54bd4..a80f25d6b6 100644 --- a/itest/context/src/integration-test/java/org/springframework/security/integration/SEC933ApplicationContextTests.java +++ b/itest/context/src/integration-test/java/org/springframework/security/integration/SEC933ApplicationContextTests.java @@ -16,18 +16,18 @@ package org.springframework.security.integration; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @ContextConfiguration(locations = { "/sec-933-app-context.xml" }) -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class SEC933ApplicationContextTests { @Autowired diff --git a/itest/context/src/integration-test/java/org/springframework/security/integration/SEC936ApplicationContextTests.java b/itest/context/src/integration-test/java/org/springframework/security/integration/SEC936ApplicationContextTests.java index 66e82b0f28..cc49be6d4e 100644 --- a/itest/context/src/integration-test/java/org/springframework/security/integration/SEC936ApplicationContextTests.java +++ b/itest/context/src/integration-test/java/org/springframework/security/integration/SEC936ApplicationContextTests.java @@ -16,8 +16,8 @@ package org.springframework.security.integration; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; @@ -25,7 +25,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.session.SessionRegistry; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @since 2.0 */ @ContextConfiguration(locations = { "/sec-936-app-context.xml" }) -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class SEC936ApplicationContextTests { /** diff --git a/itest/context/src/integration-test/java/org/springframework/security/integration/python/PythonInterpreterBasedSecurityTests.java b/itest/context/src/integration-test/java/org/springframework/security/integration/python/PythonInterpreterBasedSecurityTests.java index b01eeb24c2..2958b435fc 100644 --- a/itest/context/src/integration-test/java/org/springframework/security/integration/python/PythonInterpreterBasedSecurityTests.java +++ b/itest/context/src/integration-test/java/org/springframework/security/integration/python/PythonInterpreterBasedSecurityTests.java @@ -16,17 +16,17 @@ package org.springframework.security.integration.python; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; @ContextConfiguration(locations = { "/python-method-access-app-context.xml" }) -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class PythonInterpreterBasedSecurityTests { @Autowired diff --git a/itest/context/src/integration-test/java/org/springframework/security/performance/FilterChainPerformanceTests.java b/itest/context/src/integration-test/java/org/springframework/security/performance/FilterChainPerformanceTests.java index eb0f760253..e53d4f839e 100644 --- a/itest/context/src/integration-test/java/org/springframework/security/performance/FilterChainPerformanceTests.java +++ b/itest/context/src/integration-test/java/org/springframework/security/performance/FilterChainPerformanceTests.java @@ -21,11 +21,11 @@ import java.util.List; import javax.servlet.http.HttpSession; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -40,7 +40,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.context.HttpSessionSecurityContextRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.util.StopWatch; /** @@ -48,7 +48,7 @@ import org.springframework.util.StopWatch; * @since 2.0 */ @ContextConfiguration(locations = { "/filter-chain-performance-app-context.xml" }) -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class FilterChainPerformanceTests { // Adjust as required @@ -71,7 +71,7 @@ public class FilterChainPerformanceTests { @Qualifier("fcpFullStack") private FilterChainProxy fullStack; - @Before + @BeforeEach public void createAuthenticatedSession() { this.session = new MockHttpSession(); SecurityContextHolder.getContext().setAuthentication(this.user); @@ -80,12 +80,12 @@ public class FilterChainPerformanceTests { SecurityContextHolder.clearContext(); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } - @AfterClass + @AfterAll public static void dumpStopWatch() { System.out.println(sw.prettyPrint()); } diff --git a/itest/context/src/integration-test/java/org/springframework/security/performance/ProtectPointcutPerformanceTests.java b/itest/context/src/integration-test/java/org/springframework/security/performance/ProtectPointcutPerformanceTests.java index bd3aa82544..de91a77c94 100644 --- a/itest/context/src/integration-test/java/org/springframework/security/performance/ProtectPointcutPerformanceTests.java +++ b/itest/context/src/integration-test/java/org/springframework/security/performance/ProtectPointcutPerformanceTests.java @@ -16,9 +16,9 @@ package org.springframework.security.performance; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; @@ -27,7 +27,7 @@ import org.springframework.security.authentication.AuthenticationCredentialsNotF import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.session.SessionRegistry; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.util.StopWatch; import static org.assertj.core.api.Assertions.fail; @@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.fail; * @author Luke Taylor */ @ContextConfiguration(locations = { "/protect-pointcut-performance-app-context.xml" }) -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) public class ProtectPointcutPerformanceTests implements ApplicationContextAware { ApplicationContext ctx; - @Before + @BeforeEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/itest/ldap/embedded-ldap-apacheds-default/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java b/itest/ldap/embedded-ldap-apacheds-default/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java index 3898aea503..4f2be179a3 100644 --- a/itest/ldap/embedded-ldap-apacheds-default/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java +++ b/itest/ldap/embedded-ldap-apacheds-default/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java @@ -16,9 +16,9 @@ package org.springframework.security; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.security.config.BeanIds; @@ -33,12 +33,12 @@ public class LdapServerBeanDefinitionParserTests { private ClassPathXmlApplicationContext context; - @Before + @BeforeEach public void setup() { this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); } - @After + @AfterEach public void closeAppContext() { if (this.context != null) { this.context.close(); diff --git a/itest/ldap/embedded-ldap-mode-apacheds/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java b/itest/ldap/embedded-ldap-mode-apacheds/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java index 3898aea503..4f2be179a3 100644 --- a/itest/ldap/embedded-ldap-mode-apacheds/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java +++ b/itest/ldap/embedded-ldap-mode-apacheds/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java @@ -16,9 +16,9 @@ package org.springframework.security; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.security.config.BeanIds; @@ -33,12 +33,12 @@ public class LdapServerBeanDefinitionParserTests { private ClassPathXmlApplicationContext context; - @Before + @BeforeEach public void setup() { this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); } - @After + @AfterEach public void closeAppContext() { if (this.context != null) { this.context.close(); diff --git a/itest/ldap/embedded-ldap-mode-unboundid/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java b/itest/ldap/embedded-ldap-mode-unboundid/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java index e169615b21..b8acb3c79e 100644 --- a/itest/ldap/embedded-ldap-mode-unboundid/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java +++ b/itest/ldap/embedded-ldap-mode-unboundid/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java @@ -16,9 +16,9 @@ package org.springframework.security; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.security.config.BeanIds; @@ -33,12 +33,12 @@ public class LdapServerBeanDefinitionParserTests { private ClassPathXmlApplicationContext context; - @Before + @BeforeEach public void setup() { this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); } - @After + @AfterEach public void closeAppContext() { if (this.context != null) { this.context.close(); diff --git a/itest/ldap/embedded-ldap-none/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java b/itest/ldap/embedded-ldap-none/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java index acb872697d..1c06601a35 100644 --- a/itest/ldap/embedded-ldap-none/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java +++ b/itest/ldap/embedded-ldap-none/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java @@ -16,8 +16,8 @@ package org.springframework.security; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -31,7 +31,7 @@ public class LdapServerBeanDefinitionParserTests { private ClassPathXmlApplicationContext context; - @After + @AfterEach public void closeAppContext() { if (this.context != null) { this.context.close(); diff --git a/itest/ldap/embedded-ldap-unboundid-default/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java b/itest/ldap/embedded-ldap-unboundid-default/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java index e169615b21..b8acb3c79e 100644 --- a/itest/ldap/embedded-ldap-unboundid-default/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java +++ b/itest/ldap/embedded-ldap-unboundid-default/src/integration-test/java/org/springframework/security/LdapServerBeanDefinitionParserTests.java @@ -16,9 +16,9 @@ package org.springframework.security; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.security.config.BeanIds; @@ -33,12 +33,12 @@ public class LdapServerBeanDefinitionParserTests { private ClassPathXmlApplicationContext context; - @Before + @BeforeEach public void setup() { this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"); } - @After + @AfterEach public void closeAppContext() { if (this.context != null) { this.context.close(); diff --git a/itest/web/src/integration-test/java/org/springframework/security/integration/AbstractWebServerIntegrationTests.java b/itest/web/src/integration-test/java/org/springframework/security/integration/AbstractWebServerIntegrationTests.java index 8f1ef5b8e1..3b6f58ce0b 100644 --- a/itest/web/src/integration-test/java/org/springframework/security/integration/AbstractWebServerIntegrationTests.java +++ b/itest/web/src/integration-test/java/org/springframework/security/integration/AbstractWebServerIntegrationTests.java @@ -16,7 +16,7 @@ package org.springframework.security.integration; -import org.junit.After; +import org.junit.jupiter.api.AfterEach; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.mock.web.MockServletContext; @@ -38,7 +38,7 @@ public abstract class AbstractWebServerIntegrationTests { protected ConfigurableApplicationContext context; - @After + @AfterEach public void close() { if (this.context != null) { this.context.close(); diff --git a/itest/web/src/integration-test/java/org/springframework/security/integration/BasicAuthenticationTests.java b/itest/web/src/integration-test/java/org/springframework/security/integration/BasicAuthenticationTests.java index 3b69dd4899..10bc25c4ec 100644 --- a/itest/web/src/integration-test/java/org/springframework/security/integration/BasicAuthenticationTests.java +++ b/itest/web/src/integration-test/java/org/springframework/security/integration/BasicAuthenticationTests.java @@ -16,7 +16,7 @@ package org.springframework.security.integration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; diff --git a/itest/web/src/integration-test/java/org/springframework/security/integration/ConcurrentSessionManagementTests.java b/itest/web/src/integration-test/java/org/springframework/security/integration/ConcurrentSessionManagementTests.java index 6d93da3973..11a0810c8c 100644 --- a/itest/web/src/integration-test/java/org/springframework/security/integration/ConcurrentSessionManagementTests.java +++ b/itest/web/src/integration-test/java/org/springframework/security/integration/ConcurrentSessionManagementTests.java @@ -19,7 +19,7 @@ package org.springframework.security.integration; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpSession; import org.springframework.security.core.context.SecurityContext; diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/DefaultSpringSecurityContextSourceTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/DefaultSpringSecurityContextSourceTests.java index 265dde632e..e9a12e16c9 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/DefaultSpringSecurityContextSourceTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/DefaultSpringSecurityContextSourceTests.java @@ -20,14 +20,14 @@ import java.util.ArrayList; import java.util.Hashtable; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.AuthenticationException; import org.springframework.ldap.core.support.AbstractContextSource; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException * @author Luke Taylor * @author Eddú Meléndez */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = ApacheDsContainerConfig.class) public class DefaultSpringSecurityContextSourceTests { diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/SpringSecurityLdapTemplateITests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/SpringSecurityLdapTemplateITests.java index 405b129667..3257694f4f 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/SpringSecurityLdapTemplateITests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/SpringSecurityLdapTemplateITests.java @@ -26,16 +26,16 @@ import javax.naming.directory.DirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.UncategorizedLdapException; import org.springframework.ldap.core.ContextExecutor; import org.springframework.security.crypto.codec.Utf8; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Luke Taylor * @author Eddú Meléndez */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = ApacheDsContainerConfig.class) public class SpringSecurityLdapTemplateITests { @@ -53,7 +53,7 @@ public class SpringSecurityLdapTemplateITests { private SpringSecurityLdapTemplate template; - @Before + @BeforeEach public void setUp() { this.template = new SpringSecurityLdapTemplate(this.contextSource); } diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/authentication/BindAuthenticatorTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/authentication/BindAuthenticatorTests.java index 47151dfac7..bfffaa17de 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/authentication/BindAuthenticatorTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/authentication/BindAuthenticatorTests.java @@ -16,9 +16,9 @@ package org.springframework.security.ldap.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.core.DirContextOperations; @@ -30,7 +30,7 @@ import org.springframework.security.ldap.ApacheDsContainerConfig; import org.springframework.security.ldap.DefaultSpringSecurityContextSource; import org.springframework.security.ldap.search.FilterBasedLdapUserSearch; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Luke Taylor * @author Eddú Meléndez */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = ApacheDsContainerConfig.class) public class BindAuthenticatorTests { @@ -52,7 +52,7 @@ public class BindAuthenticatorTests { private Authentication bob; - @Before + @BeforeEach public void setUp() { this.authenticator = new BindAuthenticator(this.contextSource); this.authenticator.setMessageSource(new SpringSecurityMessageSource()); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticatorTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticatorTests.java index bced081eec..645da5c962 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticatorTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticatorTests.java @@ -16,9 +16,9 @@ package org.springframework.security.ldap.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.core.DirContextAdapter; @@ -33,7 +33,7 @@ import org.springframework.security.crypto.password.NoOpPasswordEncoder; import org.springframework.security.ldap.ApacheDsContainerConfig; import org.springframework.security.ldap.DefaultSpringSecurityContextSource; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException * @author Luke Taylor * @author Eddú Meléndez */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = ApacheDsContainerConfig.class) public class PasswordComparisonAuthenticatorTests { @@ -58,7 +58,7 @@ public class PasswordComparisonAuthenticatorTests { private Authentication ben; - @Before + @BeforeEach public void setUp() { this.authenticator = new PasswordComparisonAuthenticator(this.contextSource); this.authenticator.setPasswordEncoder(NoOpPasswordEncoder.getInstance()); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearchTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearchTests.java index bcdf501b75..4a3dc2e2d8 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearchTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearchTests.java @@ -18,8 +18,8 @@ package org.springframework.security.ldap.search; import javax.naming.ldap.LdapName; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.IncorrectResultSizeDataAccessException; @@ -28,7 +28,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.ldap.ApacheDsContainerConfig; import org.springframework.security.ldap.DefaultSpringSecurityContextSource; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Luke Taylor * @author Eddú Meléndez */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = ApacheDsContainerConfig.class) public class FilterBasedLdapUserSearchTests { diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearchWithSpacesTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearchWithSpacesTests.java index 7a0589f8e7..6db08933fa 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearchWithSpacesTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearchWithSpacesTests.java @@ -18,8 +18,8 @@ package org.springframework.security.ldap.search; import javax.naming.ldap.LdapName; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.annotation.Autowired; @@ -30,7 +30,7 @@ import org.springframework.ldap.core.DirContextOperations; import org.springframework.security.ldap.DefaultSpringSecurityContextSource; import org.springframework.security.ldap.server.ApacheDSContainer; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Steve Riesenberg */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = FilterBasedLdapUserSearchWithSpacesTests.ApacheDsContainerWithSpacesConfig.class) public class FilterBasedLdapUserSearchWithSpacesTests { diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSContainerTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSContainerTests.java index 7085abef65..235bb938d7 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSContainerTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSContainerTests.java @@ -24,9 +24,8 @@ import java.security.UnrecoverableKeyException; import java.util.ArrayList; import java.util.List; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.springframework.core.io.ClassPathResource; import org.springframework.util.FileCopyUtils; @@ -47,8 +46,8 @@ import static org.assertj.core.api.Assertions.fail; */ public class ApacheDSContainerTests { - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); + @TempDir + public File temporaryFolder; // SEC-2162 @Test @@ -121,7 +120,7 @@ public class ApacheDSContainerTests { public void startWithLdapOverSslWithWrongPassword() throws Exception { final ClassPathResource keyStoreResource = new ClassPathResource( "/org/springframework/security/ldap/server/spring.keystore"); - final File temporaryKeyStoreFile = new File(this.temporaryFolder.getRoot(), "spring.keystore"); + final File temporaryKeyStoreFile = new File(this.temporaryFolder, "spring.keystore"); FileCopyUtils.copy(keyStoreResource.getInputStream(), new FileOutputStream(temporaryKeyStoreFile)); assertThat(temporaryKeyStoreFile).isFile(); @@ -155,7 +154,7 @@ public class ApacheDSContainerTests { final ClassPathResource keyStoreResource = new ClassPathResource( "/org/springframework/security/ldap/server/spring.keystore"); - final File temporaryKeyStoreFile = new File(this.temporaryFolder.getRoot(), "spring.keystore"); + final File temporaryKeyStoreFile = new File(this.temporaryFolder, "spring.keystore"); FileCopyUtils.copy(keyStoreResource.getInputStream(), new FileOutputStream(temporaryKeyStoreFile)); assertThat(temporaryKeyStoreFile).isFile(); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSEmbeddedLdifTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSEmbeddedLdifTests.java index d166c00933..3ffa2a735d 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSEmbeddedLdifTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSEmbeddedLdifTests.java @@ -16,10 +16,10 @@ package org.springframework.security.ldap.server; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.ldap.core.support.LdapContextSource; import org.springframework.security.ldap.SpringSecurityLdapTemplate; @@ -42,7 +42,7 @@ public class ApacheDSEmbeddedLdifTests { private SpringSecurityLdapTemplate ldapTemplate; - @Before + @BeforeEach public void setUp() throws Exception { // TODO: InMemoryXmlApplicationContext would be useful here, but it is not visible this.server = new ApacheDSContainer(LDAP_ROOT, "classpath:test-server-custom-attribute-types.ldif"); @@ -60,14 +60,14 @@ public class ApacheDSEmbeddedLdifTests { return ldapContextSource; } - @After + @AfterEach public void tearDown() throws Exception { if (this.server != null) { this.server.destroy(); } } - @Ignore // Not fixed yet + @Disabled // Not fixed yet @Test // SEC-2387 public void customAttributeTypesShouldBeProperlyCreatedWhenLoadedFromLdif() { assertThat(this.ldapTemplate.compare("uid=objectWithCustomAttribute1", "uid", "objectWithCustomAttribute1")) diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerLdifTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerLdifTests.java index c19bacba04..45b26ed34b 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerLdifTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerLdifTests.java @@ -16,8 +16,8 @@ package org.springframework.security.ldap.server; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.DisposableBean; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -39,7 +39,7 @@ public class UnboundIdContainerLdifTests { AnnotationConfigApplicationContext appCtx; - @After + @AfterEach public void closeAppContext() { if (this.appCtx != null) { this.appCtx.close(); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerTests.java index a86de8c005..fb7f1aeba1 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerTests.java @@ -21,7 +21,7 @@ import java.net.ServerSocket; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.support.GenericApplicationContext; diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulatorTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulatorTests.java index c28438478e..1761a6c4ae 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulatorTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulatorTests.java @@ -20,9 +20,9 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.core.ContextSource; @@ -34,7 +34,7 @@ import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.ldap.ApacheDsContainerConfig; import org.springframework.security.ldap.SpringSecurityLdapTemplate; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException * @author Luke Taylor * @author Eddú Meléndez */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = ApacheDsContainerConfig.class) @SuppressWarnings({ "deprecation" }) public class DefaultLdapAuthoritiesPopulatorTests { @@ -53,7 +53,7 @@ public class DefaultLdapAuthoritiesPopulatorTests { private DefaultLdapAuthoritiesPopulator populator; - @Before + @BeforeEach public void setUp() { this.populator = new DefaultLdapAuthoritiesPopulator(this.contextSource, "ou=groups"); this.populator.setIgnorePartialResultException(false); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManagerModifyPasswordTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManagerModifyPasswordTests.java index bdb7fce9ac..1b3948e666 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManagerModifyPasswordTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManagerModifyPasswordTests.java @@ -16,9 +16,9 @@ package org.springframework.security.ldap.userdetails; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.annotation.Autowired; @@ -32,7 +32,7 @@ import org.springframework.security.ldap.SpringSecurityLdapTemplate; import org.springframework.security.ldap.server.UnboundIdContainer; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * * @author Josh Cummings */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = LdapUserDetailsManagerModifyPasswordTests.UnboundIdContainerConfiguration.class) public class LdapUserDetailsManagerModifyPasswordTests { @@ -52,7 +52,7 @@ public class LdapUserDetailsManagerModifyPasswordTests { @Autowired ContextSource contextSource; - @Before + @BeforeEach public void setup() { this.userDetailsManager = new LdapUserDetailsManager(this.contextSource); this.userDetailsManager.setUsePasswordModifyExtensionOperation(true); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManagerTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManagerTests.java index ad49af13ca..ee2d1be55e 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManagerTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManagerTests.java @@ -18,10 +18,10 @@ package org.springframework.security.ldap.userdetails; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.core.ContextSource; @@ -36,7 +36,7 @@ import org.springframework.security.ldap.ApacheDsContainerConfig; import org.springframework.security.ldap.DefaultLdapUsernameToDnMapper; import org.springframework.security.ldap.SpringSecurityLdapTemplate; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Luke Taylor * @author Eddú Meléndez */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = ApacheDsContainerConfig.class) public class LdapUserDetailsManagerTests { @@ -59,7 +59,7 @@ public class LdapUserDetailsManagerTests { private SpringSecurityLdapTemplate template; - @Before + @BeforeEach public void setUp() { this.mgr = new LdapUserDetailsManager(this.contextSource); this.template = new SpringSecurityLdapTemplate(this.contextSource); @@ -89,7 +89,7 @@ public class LdapUserDetailsManagerTests { this.mgr.setUserDetailsMapper(new PersonContextMapper()); } - @After + @AfterEach public void onTearDown() { // Iterator people = template.list("ou=testpeople").iterator(); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulatorTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulatorTests.java index e2c917507b..b505bfd400 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulatorTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulatorTests.java @@ -20,9 +20,9 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashSet; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ldap.core.ContextSource; @@ -30,7 +30,7 @@ import org.springframework.ldap.core.DirContextAdapter; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.ldap.ApacheDsContainerConfig; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Filip Hanik * @author Eddú Meléndez */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = ApacheDsContainerConfig.class) public class NestedLdapAuthoritiesPopulatorTests { @@ -59,7 +59,7 @@ public class NestedLdapAuthoritiesPopulatorTests { private LdapAuthority circularJavaDevelopers; - @Before + @BeforeEach public void setUp() { this.populator = new NestedLdapAuthoritiesPopulator(this.contextSource, "ou=jdeveloper"); this.populator.setGroupSearchFilter("(member={0})"); diff --git a/ldap/src/test/java/org/springframework/security/ldap/LdapUtilsTests.java b/ldap/src/test/java/org/springframework/security/ldap/LdapUtilsTests.java index ae84d19654..104628f451 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/LdapUtilsTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/LdapUtilsTests.java @@ -19,7 +19,7 @@ package org.springframework.security.ldap; import javax.naming.NamingException; import javax.naming.directory.DirContext; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; diff --git a/ldap/src/test/java/org/springframework/security/ldap/SpringSecurityAuthenticationSourceTests.java b/ldap/src/test/java/org/springframework/security/ldap/SpringSecurityAuthenticationSourceTests.java index 9eab38ef2e..adb208572c 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/SpringSecurityAuthenticationSourceTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/SpringSecurityAuthenticationSourceTests.java @@ -16,9 +16,9 @@ package org.springframework.security.ldap; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.ldap.core.AuthenticationSource; import org.springframework.ldap.core.DistinguishedName; @@ -37,8 +37,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ public class SpringSecurityAuthenticationSourceTests { - @Before - @After + @BeforeEach + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/ldap/src/test/java/org/springframework/security/ldap/SpringSecurityLdapTemplateTests.java b/ldap/src/test/java/org/springframework/security/ldap/SpringSecurityLdapTemplateTests.java index 5494ae1490..cf5c58500f 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/SpringSecurityLdapTemplateTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/SpringSecurityLdapTemplateTests.java @@ -21,12 +21,12 @@ import javax.naming.directory.DirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.ldap.core.DirContextAdapter; import org.springframework.ldap.core.DistinguishedName; @@ -37,7 +37,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SpringSecurityLdapTemplateTests { @Mock diff --git a/ldap/src/test/java/org/springframework/security/ldap/authentication/LdapAuthenticationProviderTests.java b/ldap/src/test/java/org/springframework/security/ldap/authentication/LdapAuthenticationProviderTests.java index 2c1a498de5..c006829f18 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/authentication/LdapAuthenticationProviderTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/authentication/LdapAuthenticationProviderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.ldap.authentication; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.ldap.CommunicationException; import org.springframework.ldap.core.DirContextAdapter; diff --git a/ldap/src/test/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticatorMockTests.java b/ldap/src/test/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticatorMockTests.java index 7a1a8e35bd..3cc38176eb 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticatorMockTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticatorMockTests.java @@ -22,7 +22,7 @@ import javax.naming.directory.BasicAttributes; import javax.naming.directory.DirContext; import javax.naming.directory.SearchControls; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.ldap.core.support.BaseLdapPathContextSource; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java b/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java index d39d75efde..4d0a5bc2a6 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java @@ -30,8 +30,8 @@ import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import org.apache.directory.shared.ldap.util.EmptyEnumeration; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.dao.IncorrectResultSizeDataAccessException; @@ -70,7 +70,7 @@ public class ActiveDirectoryLdapAuthenticationProviderTests { UsernamePasswordAuthenticationToken joe = new UsernamePasswordAuthenticationToken("joe", "password"); - @Before + @BeforeEach public void setUp() { this.provider = new ActiveDirectoryLdapAuthenticationProvider("mydomain.eu", "ldap://192.168.1.200/"); } diff --git a/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyAwareContextSourceTests.java b/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyAwareContextSourceTests.java index 3ad5e279e0..1be134ce6d 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyAwareContextSourceTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyAwareContextSourceTests.java @@ -24,8 +24,8 @@ import javax.naming.directory.DirContext; import javax.naming.ldap.Control; import javax.naming.ldap.LdapContext; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.ldap.UncategorizedLdapException; @@ -46,7 +46,7 @@ public class PasswordPolicyAwareContextSourceTests { private final LdapContext ctx = mock(LdapContext.class); - @Before + @BeforeEach public void setUp() { reset(this.ctx); this.ctxSource = new PasswordPolicyAwareContextSource("ldap://blah:789/dc=springframework,dc=org") { diff --git a/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyControlFactoryTests.java b/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyControlFactoryTests.java index 50babf5437..74c0349061 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyControlFactoryTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyControlFactoryTests.java @@ -18,7 +18,7 @@ package org.springframework.security.ldap.ppolicy; import javax.naming.ldap.Control; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; diff --git a/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControlTests.java b/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControlTests.java index 0422f10ef7..40408a5a1e 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControlTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControlTests.java @@ -16,7 +16,7 @@ package org.springframework.security.ldap.ppolicy; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/ldap/src/test/java/org/springframework/security/ldap/userdetails/InetOrgPersonTests.java b/ldap/src/test/java/org/springframework/security/ldap/userdetails/InetOrgPersonTests.java index 5e007f84ed..a1279c3471 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/userdetails/InetOrgPersonTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/userdetails/InetOrgPersonTests.java @@ -19,7 +19,7 @@ package org.springframework.security.ldap.userdetails; import java.util.HashSet; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.ldap.core.DirContextAdapter; import org.springframework.ldap.core.DistinguishedName; diff --git a/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapAuthorityTests.java b/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapAuthorityTests.java index 27b9c8421e..c858dd6072 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapAuthorityTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapAuthorityTests.java @@ -21,8 +21,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.ldap.SpringSecurityLdapTemplate; @@ -37,7 +37,7 @@ public class LdapAuthorityTests { LdapAuthority authority; - @Before + @BeforeEach public void setUp() { Map> attributes = new HashMap<>(); attributes.put(SpringSecurityLdapTemplate.DN_KEY, Arrays.asList(DN)); diff --git a/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsImplTests.java b/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsImplTests.java index e803d89288..8d46877fe9 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsImplTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsImplTests.java @@ -16,7 +16,7 @@ package org.springframework.security.ldap.userdetails; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.CredentialsContainer; diff --git a/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsMapperTests.java b/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsMapperTests.java index e0205051e3..6cfd7cb518 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsMapperTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsMapperTests.java @@ -19,7 +19,7 @@ package org.springframework.security.ldap.userdetails; import javax.naming.directory.BasicAttribute; import javax.naming.directory.BasicAttributes; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.ldap.core.DirContextAdapter; import org.springframework.ldap.core.DistinguishedName; diff --git a/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsServiceTests.java b/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsServiceTests.java index 8db2b98c57..9bb5593703 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsServiceTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsServiceTests.java @@ -19,7 +19,7 @@ package org.springframework.security.ldap.userdetails; import java.util.Collection; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.ldap.core.DirContextAdapter; import org.springframework.ldap.core.DirContextOperations; diff --git a/ldap/src/test/java/org/springframework/security/ldap/userdetails/UserDetailsServiceLdapAuthoritiesPopulatorTests.java b/ldap/src/test/java/org/springframework/security/ldap/userdetails/UserDetailsServiceLdapAuthoritiesPopulatorTests.java index 09ea5382e6..b2912790af 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/userdetails/UserDetailsServiceLdapAuthoritiesPopulatorTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/userdetails/UserDetailsServiceLdapAuthoritiesPopulatorTests.java @@ -19,7 +19,7 @@ package org.springframework.security.ldap.userdetails; import java.util.Collection; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.ldap.core.DirContextAdapter; import org.springframework.security.core.GrantedAuthority; diff --git a/messaging/src/test/java/org/springframework/security/messaging/access/expression/DefaultMessageSecurityExpressionHandlerTests.java b/messaging/src/test/java/org/springframework/security/messaging/access/expression/DefaultMessageSecurityExpressionHandlerTests.java index 6cae7045d5..52d83897ef 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/access/expression/DefaultMessageSecurityExpressionHandlerTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/access/expression/DefaultMessageSecurityExpressionHandlerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.messaging.access.expression; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DefaultMessageSecurityExpressionHandlerTests { @Mock @@ -54,7 +54,7 @@ public class DefaultMessageSecurityExpressionHandlerTests { Authentication authentication; - @Before + @BeforeEach public void setup() { this.handler = new DefaultMessageSecurityExpressionHandler<>(); this.message = new GenericMessage<>(""); diff --git a/messaging/src/test/java/org/springframework/security/messaging/access/expression/ExpressionBasedMessageSecurityMetadataSourceFactoryTests.java b/messaging/src/test/java/org/springframework/security/messaging/access/expression/ExpressionBasedMessageSecurityMetadataSourceFactoryTests.java index f4a66f8761..977d2f3606 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/access/expression/ExpressionBasedMessageSecurityMetadataSourceFactoryTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/access/expression/ExpressionBasedMessageSecurityMetadataSourceFactoryTests.java @@ -19,11 +19,11 @@ package org.springframework.security.messaging.access.expression; import java.util.Collection; import java.util.LinkedHashMap; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.messaging.Message; import org.springframework.security.access.ConfigAttribute; @@ -34,7 +34,7 @@ import org.springframework.security.messaging.util.matcher.MessageMatcher; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ExpressionBasedMessageSecurityMetadataSourceFactoryTests { @Mock @@ -59,7 +59,7 @@ public class ExpressionBasedMessageSecurityMetadataSourceFactoryTests { MessageSecurityExpressionRoot rootObject; - @Before + @BeforeEach public void setup() { this.expression1 = "permitAll"; this.expression2 = "denyAll"; diff --git a/messaging/src/test/java/org/springframework/security/messaging/access/expression/MessageExpressionConfigAttributeTests.java b/messaging/src/test/java/org/springframework/security/messaging/access/expression/MessageExpressionConfigAttributeTests.java index 02113a6251..9934ad044f 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/access/expression/MessageExpressionConfigAttributeTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/access/expression/MessageExpressionConfigAttributeTests.java @@ -16,11 +16,11 @@ package org.springframework.security.messaging.access.expression; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; @@ -36,7 +36,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MessageExpressionConfigAttributeTests { @Mock @@ -47,7 +47,7 @@ public class MessageExpressionConfigAttributeTests { MessageExpressionConfigAttribute attribute; - @Before + @BeforeEach public void setup() { this.attribute = new MessageExpressionConfigAttribute(this.expression, this.matcher); } diff --git a/messaging/src/test/java/org/springframework/security/messaging/access/expression/MessageExpressionVoterTests.java b/messaging/src/test/java/org/springframework/security/messaging/access/expression/MessageExpressionVoterTests.java index 270ea4dc7a..f7c7ea14ea 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/access/expression/MessageExpressionVoterTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/access/expression/MessageExpressionVoterTests.java @@ -19,11 +19,11 @@ package org.springframework.security.messaging.access.expression; import java.util.Arrays; import java.util.Collection; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; @@ -43,7 +43,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MessageExpressionVoterTests { @Mock @@ -68,7 +68,7 @@ public class MessageExpressionVoterTests { MessageExpressionVoter voter; - @Before + @BeforeEach public void setup() { this.attributes = Arrays .asList(new MessageExpressionConfigAttribute(this.expression, this.matcher)); diff --git a/messaging/src/test/java/org/springframework/security/messaging/access/intercept/ChannelSecurityInterceptorTests.java b/messaging/src/test/java/org/springframework/security/messaging/access/intercept/ChannelSecurityInterceptorTests.java index 3e8356cd98..5d865cf696 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/access/intercept/ChannelSecurityInterceptorTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/access/intercept/ChannelSecurityInterceptorTests.java @@ -20,12 +20,12 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; @@ -46,7 +46,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.willThrow; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ChannelSecurityInterceptorTests { @Mock @@ -73,7 +73,7 @@ public class ChannelSecurityInterceptorTests { ChannelSecurityInterceptor interceptor; - @Before + @BeforeEach public void setup() { this.attrs = Arrays.asList(new SecurityConfig("ROLE_USER")); this.interceptor = new ChannelSecurityInterceptor(this.source); @@ -83,7 +83,7 @@ public class ChannelSecurityInterceptorTests { SecurityContextHolder.getContext().setAuthentication(this.originalAuth); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/messaging/src/test/java/org/springframework/security/messaging/access/intercept/DefaultMessageSecurityMetadataSourceTests.java b/messaging/src/test/java/org/springframework/security/messaging/access/intercept/DefaultMessageSecurityMetadataSourceTests.java index 4bf00db940..dd7d41aa94 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/access/intercept/DefaultMessageSecurityMetadataSourceTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/access/intercept/DefaultMessageSecurityMetadataSourceTests.java @@ -20,11 +20,11 @@ import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashMap; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.messaging.Message; import org.springframework.security.access.ConfigAttribute; @@ -35,7 +35,7 @@ import org.springframework.security.messaging.util.matcher.MessageMatcher; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DefaultMessageSecurityMetadataSourceTests { @Mock @@ -58,7 +58,7 @@ public class DefaultMessageSecurityMetadataSourceTests { MessageSecurityMetadataSource source; - @Before + @BeforeEach public void setup() { this.messageMap = new LinkedHashMap<>(); this.messageMap.put(this.matcher1, Arrays.asList(this.config1)); diff --git a/messaging/src/test/java/org/springframework/security/messaging/context/AuthenticationPrincipalArgumentResolverTests.java b/messaging/src/test/java/org/springframework/security/messaging/context/AuthenticationPrincipalArgumentResolverTests.java index c8700c7cce..7f0148bc12 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/context/AuthenticationPrincipalArgumentResolverTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/context/AuthenticationPrincipalArgumentResolverTests.java @@ -22,9 +22,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Method; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.MethodParameter; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -48,12 +48,12 @@ public class AuthenticationPrincipalArgumentResolverTests { private AuthenticationPrincipalArgumentResolver resolver; - @Before + @BeforeEach public void setup() { this.resolver = new AuthenticationPrincipalArgumentResolver(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/messaging/src/test/java/org/springframework/security/messaging/context/SecurityContextChannelInterceptorTests.java b/messaging/src/test/java/org/springframework/security/messaging/context/SecurityContextChannelInterceptorTests.java index 7f6c93a1aa..1901b87aaa 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/context/SecurityContextChannelInterceptorTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/context/SecurityContextChannelInterceptorTests.java @@ -18,12 +18,12 @@ package org.springframework.security.messaging.context; import java.security.Principal; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHandler; @@ -38,7 +38,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityContextChannelInterceptorTests { @Mock @@ -58,7 +58,7 @@ public class SecurityContextChannelInterceptorTests { AnonymousAuthenticationToken expectedAnonymous; - @Before + @BeforeEach public void setup() { this.authentication = new TestingAuthenticationToken("user", "pass", "ROLE_USER"); this.messageBuilder = MessageBuilder.withPayload("payload"); @@ -67,7 +67,7 @@ public class SecurityContextChannelInterceptorTests { this.interceptor = new SecurityContextChannelInterceptor(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/messaging/src/test/java/org/springframework/security/messaging/handler/invocation/reactive/AuthenticationPrincipalArgumentResolverTests.java b/messaging/src/test/java/org/springframework/security/messaging/handler/invocation/reactive/AuthenticationPrincipalArgumentResolverTests.java index ebc7fe9514..818e2cf351 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/handler/invocation/reactive/AuthenticationPrincipalArgumentResolverTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/handler/invocation/reactive/AuthenticationPrincipalArgumentResolverTests.java @@ -19,7 +19,7 @@ package org.springframework.security.messaging.handler.invocation.reactive; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; diff --git a/messaging/src/test/java/org/springframework/security/messaging/handler/invocation/reactive/CurrentSecurityContextArgumentResolverTests.java b/messaging/src/test/java/org/springframework/security/messaging/handler/invocation/reactive/CurrentSecurityContextArgumentResolverTests.java index 79f86ce422..fdcfb2e2ac 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/handler/invocation/reactive/CurrentSecurityContextArgumentResolverTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/handler/invocation/reactive/CurrentSecurityContextArgumentResolverTests.java @@ -19,7 +19,7 @@ package org.springframework.security.messaging.handler.invocation.reactive; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; diff --git a/messaging/src/test/java/org/springframework/security/messaging/util/matcher/AndMessageMatcherTests.java b/messaging/src/test/java/org/springframework/security/messaging/util/matcher/AndMessageMatcherTests.java index 0b352d7f71..5d93374087 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/util/matcher/AndMessageMatcherTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/util/matcher/AndMessageMatcherTests.java @@ -20,10 +20,10 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.messaging.Message; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.assertj.core.api.Assertions.assertThatNullPointerException; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AndMessageMatcherTests { @Mock diff --git a/messaging/src/test/java/org/springframework/security/messaging/util/matcher/OrMessageMatcherTests.java b/messaging/src/test/java/org/springframework/security/messaging/util/matcher/OrMessageMatcherTests.java index ddf6c198df..7ee7f0227d 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/util/matcher/OrMessageMatcherTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/util/matcher/OrMessageMatcherTests.java @@ -20,10 +20,10 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.messaging.Message; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.assertj.core.api.Assertions.assertThatNullPointerException; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OrMessageMatcherTests { @Mock diff --git a/messaging/src/test/java/org/springframework/security/messaging/util/matcher/SimpDestinationMessageMatcherTests.java b/messaging/src/test/java/org/springframework/security/messaging/util/matcher/SimpDestinationMessageMatcherTests.java index 7f856c55a9..608b3216ae 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/util/matcher/SimpDestinationMessageMatcherTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/util/matcher/SimpDestinationMessageMatcherTests.java @@ -16,8 +16,8 @@ package org.springframework.security.messaging.util.matcher; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessageType; @@ -36,7 +36,7 @@ public class SimpDestinationMessageMatcherTests { PathMatcher pathMatcher; - @Before + @BeforeEach public void setup() { this.messageBuilder = MessageBuilder.withPayload("M"); this.matcher = new SimpDestinationMessageMatcher("/**"); diff --git a/messaging/src/test/java/org/springframework/security/messaging/util/matcher/SimpMessageTypeMatcherTests.java b/messaging/src/test/java/org/springframework/security/messaging/util/matcher/SimpMessageTypeMatcherTests.java index 438a59fb41..8dca602407 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/util/matcher/SimpMessageTypeMatcherTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/util/matcher/SimpMessageTypeMatcherTests.java @@ -16,8 +16,8 @@ package org.springframework.security.messaging.util.matcher; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.messaging.Message; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; @@ -31,7 +31,7 @@ public class SimpMessageTypeMatcherTests { private SimpMessageTypeMatcher matcher; - @Before + @BeforeEach public void setup() { this.matcher = new SimpMessageTypeMatcher(SimpMessageType.MESSAGE); } diff --git a/messaging/src/test/java/org/springframework/security/messaging/web/csrf/CsrfChannelInterceptorTests.java b/messaging/src/test/java/org/springframework/security/messaging/web/csrf/CsrfChannelInterceptorTests.java index 91b59bb251..fd0bb6baf5 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/web/csrf/CsrfChannelInterceptorTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/web/csrf/CsrfChannelInterceptorTests.java @@ -19,11 +19,11 @@ package org.springframework.security.messaging.web.csrf; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; @@ -37,7 +37,7 @@ import org.springframework.security.web.csrf.MissingCsrfTokenException; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CsrfChannelInterceptorTests { @Mock @@ -49,7 +49,7 @@ public class CsrfChannelInterceptorTests { CsrfChannelInterceptor interceptor; - @Before + @BeforeEach public void setup() { this.token = new DefaultCsrfToken("header", "param", "token"); this.interceptor = new CsrfChannelInterceptor(); diff --git a/messaging/src/test/java/org/springframework/security/messaging/web/socket/server/CsrfTokenHandshakeInterceptorTests.java b/messaging/src/test/java/org/springframework/security/messaging/web/socket/server/CsrfTokenHandshakeInterceptorTests.java index b92390fecd..a3c38d14d9 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/web/socket/server/CsrfTokenHandshakeInterceptorTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/web/socket/server/CsrfTokenHandshakeInterceptorTests.java @@ -19,11 +19,11 @@ package org.springframework.security.messaging.web.socket.server; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CsrfTokenHandshakeInterceptorTests { @Mock @@ -55,7 +55,7 @@ public class CsrfTokenHandshakeInterceptorTests { CsrfTokenHandshakeInterceptor interceptor; - @Before + @BeforeEach public void setup() { this.httpRequest = new MockHttpServletRequest(); this.attributes = new HashMap<>(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizationCodeOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizationCodeOAuth2AuthorizedClientProviderTests.java index e22e3d3491..6f276c235e 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizationCodeOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizationCodeOAuth2AuthorizedClientProviderTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; @@ -44,7 +44,7 @@ public class AuthorizationCodeOAuth2AuthorizedClientProviderTests { private Authentication principal; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new AuthorizationCodeOAuth2AuthorizedClientProvider(); this.clientRegistration = TestClientRegistrations.clientRegistration().build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizationCodeReactiveOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizationCodeReactiveOAuth2AuthorizedClientProviderTests.java index 15b7d5740c..2456e4b8e1 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizationCodeReactiveOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizationCodeReactiveOAuth2AuthorizedClientProviderTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; @@ -44,7 +44,7 @@ public class AuthorizationCodeReactiveOAuth2AuthorizedClientProviderTests { private Authentication principal; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new AuthorizationCodeReactiveOAuth2AuthorizedClientProvider(); this.clientRegistration = TestClientRegistrations.clientRegistration().build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizedClientServiceOAuth2AuthorizedClientManagerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizedClientServiceOAuth2AuthorizedClientManagerTests.java index e99ba59846..fe8b393d68 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizedClientServiceOAuth2AuthorizedClientManagerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizedClientServiceOAuth2AuthorizedClientManagerTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client; import java.util.Map; import java.util.function.Function; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -76,7 +76,7 @@ public class AuthorizedClientServiceOAuth2AuthorizedClientManagerTests { private ArgumentCaptor authorizationContextCaptor; @SuppressWarnings("unchecked") - @Before + @BeforeEach public void setup() { this.clientRegistrationRepository = mock(ClientRegistrationRepository.class); this.authorizedClientService = mock(OAuth2AuthorizedClientService.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizedClientServiceReactiveOAuth2AuthorizedClientManagerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizedClientServiceReactiveOAuth2AuthorizedClientManagerTests.java index 0ce1f0c675..17d397eccc 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizedClientServiceReactiveOAuth2AuthorizedClientManagerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/AuthorizedClientServiceReactiveOAuth2AuthorizedClientManagerTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client; import java.util.Map; import java.util.function.Function; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -79,7 +79,7 @@ public class AuthorizedClientServiceReactiveOAuth2AuthorizedClientManagerTests { private PublisherProbe removeAuthorizedClientProbe; @SuppressWarnings("unchecked") - @Before + @BeforeEach public void setup() { this.clientRegistrationRepository = mock(ReactiveClientRegistrationRepository.class); this.authorizedClientService = mock(ReactiveOAuth2AuthorizedClientService.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ClientCredentialsOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ClientCredentialsOAuth2AuthorizedClientProviderTests.java index c69a285ad8..fedcc753a6 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ClientCredentialsOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ClientCredentialsOAuth2AuthorizedClientProviderTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client; import java.time.Duration; import java.time.Instant; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; @@ -54,7 +54,7 @@ public class ClientCredentialsOAuth2AuthorizedClientProviderTests { private Authentication principal; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new ClientCredentialsOAuth2AuthorizedClientProvider(); this.accessTokenResponseClient = mock(OAuth2AccessTokenResponseClient.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ClientCredentialsReactiveOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ClientCredentialsReactiveOAuth2AuthorizedClientProviderTests.java index 2c11bb375f..b68928ba2b 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ClientCredentialsReactiveOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ClientCredentialsReactiveOAuth2AuthorizedClientProviderTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client; import java.time.Duration; import java.time.Instant; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -55,7 +55,7 @@ public class ClientCredentialsReactiveOAuth2AuthorizedClientProviderTests { private Authentication principal; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new ClientCredentialsReactiveOAuth2AuthorizedClientProvider(); this.accessTokenResponseClient = mock(ReactiveOAuth2AccessTokenResponseClient.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/DelegatingOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/DelegatingOAuth2AuthorizedClientProviderTests.java index f595fa571c..829c5f3966 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/DelegatingOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/DelegatingOAuth2AuthorizedClientProviderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.client; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/DelegatingReactiveOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/DelegatingReactiveOAuth2AuthorizedClientProviderTests.java index 5619fd4be2..a3228db9a0 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/DelegatingReactiveOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/DelegatingReactiveOAuth2AuthorizedClientProviderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.client; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.security.authentication.TestingAuthenticationToken; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/InMemoryOAuth2AuthorizedClientServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/InMemoryOAuth2AuthorizedClientServiceTests.java index 0afeaf067e..d7bee3126b 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/InMemoryOAuth2AuthorizedClientServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/InMemoryOAuth2AuthorizedClientServiceTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.client; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.Authentication; import org.springframework.security.oauth2.client.registration.ClientRegistration; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/InMemoryReactiveOAuth2AuthorizedClientServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/InMemoryReactiveOAuth2AuthorizedClientServiceTests.java index d61881cf99..d2223450f1 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/InMemoryReactiveOAuth2AuthorizedClientServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/InMemoryReactiveOAuth2AuthorizedClientServiceTests.java @@ -19,11 +19,11 @@ package org.springframework.security.oauth2.client; import java.time.Duration; import java.time.Instant; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -42,7 +42,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class InMemoryReactiveOAuth2AuthorizedClientServiceTests { @Mock @@ -75,7 +75,7 @@ public class InMemoryReactiveOAuth2AuthorizedClientServiceTests { .build(); // @formatter:on - @Before + @BeforeEach public void setup() { this.authorizedClientService = new InMemoryReactiveOAuth2AuthorizedClientService( this.clientRegistrationRepository); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/JdbcOAuth2AuthorizedClientServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/JdbcOAuth2AuthorizedClientServiceTests.java index cea664e166..eeac7eeaa8 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/JdbcOAuth2AuthorizedClientServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/JdbcOAuth2AuthorizedClientServiceTests.java @@ -27,9 +27,9 @@ import java.util.Collections; import java.util.List; import java.util.Set; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.dao.DataRetrievalFailureException; import org.springframework.jdbc.core.ArgumentPreparedStatementSetter; @@ -86,7 +86,7 @@ public class JdbcOAuth2AuthorizedClientServiceTests { private JdbcOAuth2AuthorizedClientService authorizedClientService; - @Before + @BeforeEach public void setUp() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); this.clientRegistrationRepository = mock(ClientRegistrationRepository.class); @@ -97,7 +97,7 @@ public class JdbcOAuth2AuthorizedClientServiceTests { this.clientRegistrationRepository); } - @After + @AfterEach public void tearDown() { this.db.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/JwtBearerOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/JwtBearerOAuth2AuthorizedClientProviderTests.java index 82d39cafd1..0ea5e25552 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/JwtBearerOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/JwtBearerOAuth2AuthorizedClientProviderTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client; import java.time.Duration; import java.time.Instant; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; @@ -61,7 +61,7 @@ public class JwtBearerOAuth2AuthorizedClientProviderTests { private Authentication principal; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new JwtBearerOAuth2AuthorizedClientProvider(); this.accessTokenResponseClient = mock(OAuth2AccessTokenResponseClient.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizationContextTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizationContextTests.java index 0a385dd806..301d20d326 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizationContextTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizationContextTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; @@ -42,7 +42,7 @@ public class OAuth2AuthorizationContextTests { private Authentication principal; - @Before + @BeforeEach public void setup() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); this.authorizedClient = new OAuth2AuthorizedClient(this.clientRegistration, "principal", diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizeRequestTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizeRequestTests.java index 588f6283f5..19e47b2e02 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizeRequestTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizeRequestTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.client; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientIdTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientIdTests.java index f8a9cdf4de..3966e4a2f8 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientIdTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientIdTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.client; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientProviderBuilderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientProviderBuilderTests.java index 3275de9195..3f03d6b3d9 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientProviderBuilderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientProviderBuilderTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client; import java.time.Duration; import java.time.Instant; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.http.RequestEntity; @@ -66,7 +66,7 @@ public class OAuth2AuthorizedClientProviderBuilderTests { private Authentication principal; @SuppressWarnings("unchecked") - @Before + @BeforeEach public void setup() { OAuth2AccessTokenResponse accessTokenResponse = TestOAuth2AccessTokenResponses.accessTokenResponse().build(); this.accessTokenClient = mock(RestOperations.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientTests.java index 91ad10b946..4111972d2a 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; @@ -40,7 +40,7 @@ public class OAuth2AuthorizedClientTests { private OAuth2AccessToken accessToken; - @Before + @BeforeEach public void setUp() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); this.principalName = "principal"; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/PasswordOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/PasswordOAuth2AuthorizedClientProviderTests.java index ad75093310..665c7acfef 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/PasswordOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/PasswordOAuth2AuthorizedClientProviderTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client; import java.time.Duration; import java.time.Instant; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; @@ -54,7 +54,7 @@ public class PasswordOAuth2AuthorizedClientProviderTests { private Authentication principal; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new PasswordOAuth2AuthorizedClientProvider(); this.accessTokenResponseClient = mock(OAuth2AccessTokenResponseClient.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/PasswordReactiveOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/PasswordReactiveOAuth2AuthorizedClientProviderTests.java index 184ce64851..1f9e69c272 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/PasswordReactiveOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/PasswordReactiveOAuth2AuthorizedClientProviderTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client; import java.time.Duration; import java.time.Instant; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -55,7 +55,7 @@ public class PasswordReactiveOAuth2AuthorizedClientProviderTests { private Authentication principal; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new PasswordReactiveOAuth2AuthorizedClientProvider(); this.accessTokenResponseClient = mock(ReactiveOAuth2AccessTokenResponseClient.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/R2dbcReactiveOAuth2AuthorizedClientServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/R2dbcReactiveOAuth2AuthorizedClientServiceTests.java index a38af89aaf..c865f302ef 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/R2dbcReactiveOAuth2AuthorizedClientServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/R2dbcReactiveOAuth2AuthorizedClientServiceTests.java @@ -24,8 +24,8 @@ import java.util.HashSet; import io.r2dbc.h2.H2ConnectionFactory; import io.r2dbc.spi.ConnectionFactory; import io.r2dbc.spi.Result; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -71,7 +71,7 @@ public class R2dbcReactiveOAuth2AuthorizedClientServiceTests { private R2dbcReactiveOAuth2AuthorizedClientService authorizedClientService; - @Before + @BeforeEach public void setUp() { final ConnectionFactory connectionFactory = createDb(); this.clientRegistration = TestClientRegistrations.clientRegistration().build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ReactiveOAuth2AuthorizedClientProviderBuilderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ReactiveOAuth2AuthorizedClientProviderBuilderTests.java index 71280097c5..d6f771c5a6 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ReactiveOAuth2AuthorizedClientProviderBuilderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/ReactiveOAuth2AuthorizedClientProviderBuilderTests.java @@ -22,9 +22,9 @@ import java.time.Instant; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.http.HttpHeaders; @@ -58,7 +58,7 @@ public class ReactiveOAuth2AuthorizedClientProviderBuilderTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -67,7 +67,7 @@ public class ReactiveOAuth2AuthorizedClientProviderBuilderTests { this.principal = new TestingAuthenticationToken("principal", "password"); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/RefreshTokenOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/RefreshTokenOAuth2AuthorizedClientProviderTests.java index e1a63fc2d2..0d143b99be 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/RefreshTokenOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/RefreshTokenOAuth2AuthorizedClientProviderTests.java @@ -21,8 +21,8 @@ import java.time.Instant; import java.util.Arrays; import java.util.HashSet; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -61,7 +61,7 @@ public class RefreshTokenOAuth2AuthorizedClientProviderTests { private OAuth2AuthorizedClient authorizedClient; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new RefreshTokenOAuth2AuthorizedClientProvider(); this.accessTokenResponseClient = mock(OAuth2AccessTokenResponseClient.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/RefreshTokenReactiveOAuth2AuthorizedClientProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/RefreshTokenReactiveOAuth2AuthorizedClientProviderTests.java index 504c9eac2e..3ba49177ea 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/RefreshTokenReactiveOAuth2AuthorizedClientProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/RefreshTokenReactiveOAuth2AuthorizedClientProviderTests.java @@ -21,8 +21,8 @@ import java.time.Instant; import java.util.Arrays; import java.util.HashSet; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import reactor.core.publisher.Mono; @@ -62,7 +62,7 @@ public class RefreshTokenReactiveOAuth2AuthorizedClientProviderTests { private OAuth2AuthorizedClient authorizedClient; - @Before + @BeforeEach public void setup() { this.authorizedClientProvider = new RefreshTokenReactiveOAuth2AuthorizedClientProvider(); this.accessTokenResponseClient = mock(ReactiveOAuth2AccessTokenResponseClient.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthenticationTokenTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthenticationTokenTests.java index 2610078fab..55408ec955 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthenticationTokenTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthenticationTokenTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client.authentication; import java.util.Collection; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.oauth2.core.user.OAuth2User; @@ -42,7 +42,7 @@ public class OAuth2AuthenticationTokenTests { private String authorizedClientRegistrationId; - @Before + @BeforeEach public void setUp() { this.principal = mock(OAuth2User.class); this.authorities = Collections.emptyList(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeAuthenticationProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeAuthenticationProviderTests.java index 2ff9683ef4..495a054659 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeAuthenticationProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeAuthenticationProviderTests.java @@ -20,8 +20,8 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient; import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest; @@ -59,7 +59,7 @@ public class OAuth2AuthorizationCodeAuthenticationProviderTests { private OAuth2AuthorizationCodeAuthenticationProvider authenticationProvider; - @Before + @BeforeEach @SuppressWarnings("unchecked") public void setUp() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeAuthenticationTokenTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeAuthenticationTokenTests.java index b96992ea85..95c18d4ee2 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeAuthenticationTokenTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeAuthenticationTokenTests.java @@ -18,8 +18,8 @@ package org.springframework.security.oauth2.client.authentication; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; @@ -45,7 +45,7 @@ public class OAuth2AuthorizationCodeAuthenticationTokenTests { private OAuth2AccessToken accessToken; - @Before + @BeforeEach public void setUp() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); this.authorizationExchange = new OAuth2AuthorizationExchange(TestOAuth2AuthorizationRequests.request().build(), diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeReactiveAuthenticationManagerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeReactiveAuthenticationManagerTests.java index 91731b0642..b2bd659b5b 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeReactiveAuthenticationManagerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2AuthorizationCodeReactiveAuthenticationManagerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.oauth2.client.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest; @@ -46,7 +46,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OAuth2AuthorizationCodeReactiveAuthenticationManagerTests { @Mock @@ -62,7 +62,7 @@ public class OAuth2AuthorizationCodeReactiveAuthenticationManagerTests { private OAuth2AccessTokenResponse.Builder tokenResponse = TestOAuth2AccessTokenResponses.accessTokenResponse(); - @Before + @BeforeEach public void setup() { this.manager = new OAuth2AuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProviderTests.java index fb7a4d5c11..701b40ac88 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProviderTests.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.stubbing.Answer; @@ -78,7 +78,7 @@ public class OAuth2LoginAuthenticationProviderTests { private OAuth2LoginAuthenticationProvider authenticationProvider; - @Before + @BeforeEach @SuppressWarnings("unchecked") public void setUp() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationTokenTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationTokenTests.java index 3c26b7b14e..df4e948551 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationTokenTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationTokenTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client.authentication; import java.util.Collection; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.oauth2.client.registration.ClientRegistration; @@ -53,7 +53,7 @@ public class OAuth2LoginAuthenticationTokenTests { private OAuth2AccessToken accessToken; - @Before + @BeforeEach public void setUp() { this.principal = mock(OAuth2User.class); this.authorities = Collections.emptyList(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginReactiveAuthenticationManagerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginReactiveAuthenticationManagerTests.java index 06eb250723..cd3854b09b 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginReactiveAuthenticationManagerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginReactiveAuthenticationManagerTests.java @@ -21,13 +21,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; import reactor.core.publisher.Mono; @@ -63,7 +63,7 @@ import static org.mockito.Mockito.mock; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OAuth2LoginReactiveAuthenticationManagerTests { @Mock @@ -82,7 +82,7 @@ public class OAuth2LoginReactiveAuthenticationManagerTests { private OAuth2LoginReactiveAuthenticationManager manager; - @Before + @BeforeEach public void setup() { this.manager = new OAuth2LoginReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService); } @@ -116,7 +116,7 @@ public class OAuth2LoginReactiveAuthenticationManagerTests { } @Test - @Ignore + @Disabled public void authenticationWhenOidcThenEmpty() { this.registration.scope("openid"); assertThat(this.manager.authenticate(loginToken()).block()).isNull(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClientTests.java index 99dc69b029..164d99b732 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClientTests.java @@ -26,9 +26,9 @@ import com.nimbusds.jose.jwk.JWK; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -62,7 +62,7 @@ public class DefaultAuthorizationCodeTokenResponseClientTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.tokenResponseClient = new DefaultAuthorizationCodeTokenResponseClient(); this.server = new MockWebServer(); @@ -78,7 +78,7 @@ public class DefaultAuthorizationCodeTokenResponseClientTests { // @formatter:on } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClientTests.java index c6e6492eb3..50c51cc818 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClientTests.java @@ -26,9 +26,9 @@ import com.nimbusds.jose.jwk.JWK; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -59,7 +59,7 @@ public class DefaultClientCredentialsTokenResponseClientTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.tokenResponseClient = new DefaultClientCredentialsTokenResponseClient(); this.server = new MockWebServer(); @@ -74,7 +74,7 @@ public class DefaultClientCredentialsTokenResponseClientTests { // @formatter:on } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClientTests.java index 1077bc08d4..4202a9ade7 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClientTests.java @@ -22,9 +22,9 @@ import java.time.Instant; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -59,7 +59,7 @@ public class DefaultJwtBearerTokenResponseClientTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.tokenResponseClient = new DefaultJwtBearerTokenResponseClient(); this.server = new MockWebServer(); @@ -76,7 +76,7 @@ public class DefaultJwtBearerTokenResponseClientTests { this.jwtAssertion = TestJwts.jwt().build(); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultPasswordTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultPasswordTokenResponseClientTests.java index 195ab0b858..dd77eb4eff 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultPasswordTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultPasswordTokenResponseClientTests.java @@ -26,9 +26,9 @@ import com.nimbusds.jose.jwk.JWK; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -63,7 +63,7 @@ public class DefaultPasswordTokenResponseClientTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.tokenResponseClient = new DefaultPasswordTokenResponseClient(); this.server = new MockWebServer(); @@ -76,7 +76,7 @@ public class DefaultPasswordTokenResponseClientTests { // @formatter:on } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClientTests.java index beae7489b0..1293f0d18e 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClientTests.java @@ -27,9 +27,9 @@ import com.nimbusds.jose.jwk.JWK; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -67,7 +67,7 @@ public class DefaultRefreshTokenTokenResponseClientTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.tokenResponseClient = new DefaultRefreshTokenTokenResponseClient(); this.server = new MockWebServer(); @@ -78,7 +78,7 @@ public class DefaultRefreshTokenTokenResponseClientTests { this.refreshToken = TestOAuth2RefreshTokens.refreshToken(); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JoseHeaderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JoseHeaderTests.java index e0a650daf0..2d69831c37 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JoseHeaderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JoseHeaderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.client.endpoint; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.jose.JwaAlgorithm; import org.springframework.security.oauth2.jose.jws.SignatureAlgorithm; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestEntityConverterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestEntityConverterTests.java index cca7638c7f..4dc03b324c 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestEntityConverterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestEntityConverterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.endpoint; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; import org.springframework.core.convert.converter.Converter; @@ -49,7 +49,7 @@ public class JwtBearerGrantRequestEntityConverterTests { private JwtBearerGrantRequestEntityConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new JwtBearerGrantRequestEntityConverter(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestTests.java index aca31d5fe4..1d1ed41f80 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtBearerGrantRequestTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.client.endpoint; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtClaimsSetTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtClaimsSetTests.java index 2b10762c66..9a23a2fb52 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtClaimsSetTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/JwtClaimsSetTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.client.endpoint; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusAuthorizationCodeTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusAuthorizationCodeTokenResponseClientTests.java index 0a9832ae49..d65c91f471 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusAuthorizationCodeTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusAuthorizationCodeTokenResponseClientTests.java @@ -20,8 +20,8 @@ import java.time.Instant; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -58,7 +58,7 @@ public class NimbusAuthorizationCodeTokenResponseClientTests { private NimbusAuthorizationCodeTokenResponseClient tokenResponseClient = new NimbusAuthorizationCodeTokenResponseClient(); - @Before + @BeforeEach public void setUp() { this.clientRegistrationBuilder = TestClientRegistrations.clientRegistration() .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusJwsEncoderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusJwsEncoderTests.java index 2d29a370ea..b97d638b07 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusJwsEncoderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusJwsEncoderTests.java @@ -34,8 +34,8 @@ import com.nimbusds.jose.jwk.RSAKey; import com.nimbusds.jose.jwk.source.JWKSource; import com.nimbusds.jose.proc.SecurityContext; import com.nimbusds.jose.util.Base64URL; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -82,7 +82,7 @@ public class NimbusJwsEncoderTests { private NimbusJwsEncoder jwsEncoder; - @Before + @BeforeEach public void setUp() { this.jwkList = new ArrayList<>(); this.jwkSource = (jwkSelector, securityContext) -> jwkSelector.select(new JWKSet(this.jwkList)); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusJwtClientAuthenticationParametersConverterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusJwtClientAuthenticationParametersConverterTests.java index ae8c41a316..42fb1dc9f8 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusJwtClientAuthenticationParametersConverterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/NimbusJwtClientAuthenticationParametersConverterTests.java @@ -27,8 +27,8 @@ import java.util.function.Function; import com.nimbusds.jose.jwk.JWK; import com.nimbusds.jose.jwk.OctetSequenceKey; import com.nimbusds.jose.jwk.RSAKey; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; @@ -63,7 +63,7 @@ public class NimbusJwtClientAuthenticationParametersConverterTests { private NimbusJwtClientAuthenticationParametersConverter converter; - @Before + @BeforeEach public void setup() { this.jwkResolver = mock(Function.class); this.converter = new NimbusJwtClientAuthenticationParametersConverter<>(this.jwkResolver); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestEntityConverterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestEntityConverterTests.java index 8394f1be8b..ca3c3a9c8d 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestEntityConverterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestEntityConverterTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client.endpoint; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; import org.springframework.core.convert.converter.Converter; @@ -56,7 +56,7 @@ public class OAuth2AuthorizationCodeGrantRequestEntityConverterTests { private OAuth2AuthorizationCodeGrantRequestEntityConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new OAuth2AuthorizationCodeGrantRequestEntityConverter(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestTests.java index 19efce989a..e3788be50f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.endpoint; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; @@ -39,7 +39,7 @@ public class OAuth2AuthorizationCodeGrantRequestTests { private OAuth2AuthorizationExchange authorizationExchange; - @Before + @BeforeEach public void setUp() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); this.authorizationExchange = TestOAuth2AuthorizationExchanges.success(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestEntityConverterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestEntityConverterTests.java index 1420135b8b..c33aad0a35 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestEntityConverterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestEntityConverterTests.java @@ -21,8 +21,8 @@ import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.Base64; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; import org.springframework.core.convert.converter.Converter; @@ -51,7 +51,7 @@ public class OAuth2ClientCredentialsGrantRequestEntityConverterTests { private OAuth2ClientCredentialsGrantRequestEntityConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new OAuth2ClientCredentialsGrantRequestEntityConverter(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestTests.java index 76a837ad86..abffc98849 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2ClientCredentialsGrantRequestTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.endpoint; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.core.AuthorizationGrantType; @@ -35,7 +35,7 @@ public class OAuth2ClientCredentialsGrantRequestTests { private ClientRegistration clientRegistration; - @Before + @BeforeEach public void setup() { // @formatter:off this.clientRegistration = ClientRegistration.withRegistrationId("registration-1") diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2PasswordGrantRequestEntityConverterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2PasswordGrantRequestEntityConverterTests.java index 7ab3519d7a..71560017d4 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2PasswordGrantRequestEntityConverterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2PasswordGrantRequestEntityConverterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.endpoint; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; import org.springframework.core.convert.converter.Converter; @@ -46,7 +46,7 @@ public class OAuth2PasswordGrantRequestEntityConverterTests { private OAuth2PasswordGrantRequestEntityConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new OAuth2PasswordGrantRequestEntityConverter(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2PasswordGrantRequestTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2PasswordGrantRequestTests.java index dfcfe69841..1535cdff04 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2PasswordGrantRequestTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2PasswordGrantRequestTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.client.endpoint; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2RefreshTokenGrantRequestEntityConverterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2RefreshTokenGrantRequestEntityConverterTests.java index 8d8d2665f0..05e8968725 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2RefreshTokenGrantRequestEntityConverterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2RefreshTokenGrantRequestEntityConverterTests.java @@ -18,8 +18,8 @@ package org.springframework.security.oauth2.client.endpoint; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; import org.springframework.core.convert.converter.Converter; @@ -52,7 +52,7 @@ public class OAuth2RefreshTokenGrantRequestEntityConverterTests { private OAuth2RefreshTokenGrantRequestEntityConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new OAuth2RefreshTokenGrantRequestEntityConverter(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2RefreshTokenGrantRequestTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2RefreshTokenGrantRequestTests.java index 8b51a22e04..195c7a9c3f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2RefreshTokenGrantRequestTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/OAuth2RefreshTokenGrantRequestTests.java @@ -20,8 +20,8 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; @@ -46,7 +46,7 @@ public class OAuth2RefreshTokenGrantRequestTests { private OAuth2RefreshToken refreshToken; - @Before + @BeforeEach public void setup() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); this.accessToken = TestOAuth2AccessTokens.scopes("read", "write"); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveAuthorizationCodeTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveAuthorizationCodeTokenResponseClientTests.java index f875b8e218..8d39992d77 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveAuthorizationCodeTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveAuthorizationCodeTokenResponseClientTests.java @@ -22,9 +22,9 @@ import java.util.Map; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -60,7 +60,7 @@ public class WebClientReactiveAuthorizationCodeTokenResponseClientTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -68,7 +68,7 @@ public class WebClientReactiveAuthorizationCodeTokenResponseClientTests { this.clientRegistration = TestClientRegistrations.clientRegistration().tokenUri(tokenUri); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveClientCredentialsTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveClientCredentialsTokenResponseClientTests.java index ca3cadfabe..dba3afb8e9 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveClientCredentialsTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveClientCredentialsTokenResponseClientTests.java @@ -23,9 +23,9 @@ import java.util.Base64; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -57,7 +57,7 @@ public class WebClientReactiveClientCredentialsTokenResponseClientTests { private ClientRegistration.Builder clientRegistration; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -65,7 +65,7 @@ public class WebClientReactiveClientCredentialsTokenResponseClientTests { .tokenUri(this.server.url("/oauth2/token").uri().toASCIIString()); } - @After + @AfterEach public void cleanup() throws Exception { validateMockitoUsage(); this.server.shutdown(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactivePasswordTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactivePasswordTokenResponseClientTests.java index ca7d4ee9c3..5595905522 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactivePasswordTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactivePasswordTokenResponseClientTests.java @@ -21,9 +21,9 @@ import java.time.Instant; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -56,7 +56,7 @@ public class WebClientReactivePasswordTokenResponseClientTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -64,7 +64,7 @@ public class WebClientReactivePasswordTokenResponseClientTests { this.clientRegistrationBuilder = TestClientRegistrations.password().tokenUri(tokenUri); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClientTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClientTests.java index 573cd9ae0f..5cea289645 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClientTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClientTests.java @@ -22,9 +22,9 @@ import java.util.Collections; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -60,7 +60,7 @@ public class WebClientReactiveRefreshTokenTokenResponseClientTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -70,7 +70,7 @@ public class WebClientReactiveRefreshTokenTokenResponseClientTests { this.refreshToken = TestOAuth2RefreshTokens.refreshToken(); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/http/OAuth2ErrorResponseErrorHandlerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/http/OAuth2ErrorResponseErrorHandlerTests.java index 8c6c1110aa..f5a8483494 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/http/OAuth2ErrorResponseErrorHandlerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/http/OAuth2ErrorResponseErrorHandlerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.client.http; import java.io.IOException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationExceptionMixinTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationExceptionMixinTests.java index 5052f98a07..ab97544e2f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationExceptionMixinTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationExceptionMixinTests.java @@ -18,8 +18,8 @@ package org.springframework.security.oauth2.client.jackson2; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.jackson2.SecurityJackson2Modules; @@ -39,7 +39,7 @@ public class OAuth2AuthenticationExceptionMixinTests { private ObjectMapper mapper; - @Before + @BeforeEach public void setup() { ClassLoader loader = getClass().getClassLoader(); this.mapper = new ObjectMapper(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationTokenMixinTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationTokenMixinTests.java index 40afdc9343..aa5ebe83ca 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationTokenMixinTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthenticationTokenMixinTests.java @@ -27,8 +27,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.DecimalUtils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.core.GrantedAuthority; @@ -60,7 +60,7 @@ public class OAuth2AuthenticationTokenMixinTests { private ObjectMapper mapper; - @Before + @BeforeEach public void setup() { ClassLoader loader = getClass().getClassLoader(); this.mapper = new ObjectMapper(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthorizationRequestMixinTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthorizationRequestMixinTests.java index 66c1d149a9..1d00de7d33 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthorizationRequestMixinTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthorizationRequestMixinTests.java @@ -23,8 +23,8 @@ import java.util.stream.Collectors; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.jackson2.SecurityJackson2Modules; @@ -47,7 +47,7 @@ public class OAuth2AuthorizationRequestMixinTests { private OAuth2AuthorizationRequest.Builder authorizationRequestBuilder; - @Before + @BeforeEach public void setup() { ClassLoader loader = getClass().getClassLoader(); this.mapper = new ObjectMapper(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthorizedClientMixinTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthorizedClientMixinTests.java index 13bfd8ed5b..2728942de7 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthorizedClientMixinTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/jackson2/OAuth2AuthorizedClientMixinTests.java @@ -24,8 +24,8 @@ import java.util.stream.Collectors; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.DecimalUtils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.jackson2.SecurityJackson2Modules; @@ -59,7 +59,7 @@ public class OAuth2AuthorizedClientMixinTests { private String principalName; - @Before + @BeforeEach public void setup() { ClassLoader loader = getClass().getClassLoader(); this.mapper = new ObjectMapper(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java index 1063f9d5ac..b7c38455f8 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.stubbing.Answer; @@ -99,7 +99,7 @@ public class OidcAuthorizationCodeAuthenticationProviderTests { private String nonceHash; - @Before + @BeforeEach @SuppressWarnings("unchecked") public void setUp() { this.clientRegistration = TestClientRegistrations.clientRegistration().clientId("client1").build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManagerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManagerTests.java index 2c1dafdc86..281b8ad31f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManagerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManagerTests.java @@ -24,12 +24,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; import reactor.core.publisher.Mono; @@ -78,7 +78,7 @@ import static org.mockito.Mockito.mock; * @author Joe Grandja * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OidcAuthorizationCodeReactiveAuthenticationManagerTests { @Mock @@ -109,7 +109,7 @@ public class OidcAuthorizationCodeReactiveAuthenticationManagerTests { private String nonceHash; - @Before + @BeforeEach public void setup() { this.manager = new OidcAuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcIdTokenDecoderFactoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcIdTokenDecoderFactoryTests.java index ef3e1df791..0642602c5c 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcIdTokenDecoderFactoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcIdTokenDecoderFactoryTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client.oidc.authentication; import java.util.Map; import java.util.function.Function; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.security.oauth2.client.registration.ClientRegistration; @@ -58,7 +58,7 @@ public class OidcIdTokenDecoderFactoryTests { private OidcIdTokenDecoderFactory idTokenDecoderFactory; - @Before + @BeforeEach public void setUp() { this.idTokenDecoderFactory = new OidcIdTokenDecoderFactory(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcIdTokenValidatorTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcIdTokenValidatorTests.java index 99b32caac6..58750c296f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcIdTokenValidatorTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcIdTokenValidatorTests.java @@ -24,8 +24,8 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; @@ -56,7 +56,7 @@ public class OidcIdTokenValidatorTests { private Duration clockSkew = Duration.ofSeconds(60); - @Before + @BeforeEach public void setup() { this.headers.put("alg", JwsAlgorithms.RS256); this.claims.put(IdTokenClaimNames.ISS, "https://example.com"); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/ReactiveOidcIdTokenDecoderFactoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/ReactiveOidcIdTokenDecoderFactoryTests.java index f5d694b549..547b1fbfa9 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/ReactiveOidcIdTokenDecoderFactoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/ReactiveOidcIdTokenDecoderFactoryTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client.oidc.authentication; import java.util.Map; import java.util.function.Function; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.security.oauth2.client.registration.ClientRegistration; @@ -57,7 +57,7 @@ public class ReactiveOidcIdTokenDecoderFactoryTests { private ReactiveOidcIdTokenDecoderFactory idTokenDecoderFactory; - @Before + @BeforeEach public void setUp() { this.idTokenDecoderFactory = new ReactiveOidcIdTokenDecoderFactory(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcReactiveOAuth2UserServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcReactiveOAuth2UserServiceTests.java index e41eafe700..5ed86f86ba 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcReactiveOAuth2UserServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcReactiveOAuth2UserServiceTests.java @@ -24,11 +24,11 @@ import java.util.Iterator; import java.util.Map; import java.util.function.Function; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.core.convert.converter.Converter; @@ -65,7 +65,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OidcReactiveOAuth2UserServiceTests { @Mock @@ -81,7 +81,7 @@ public class OidcReactiveOAuth2UserServiceTests { private OidcReactiveOAuth2UserService userService = new OidcReactiveOAuth2UserService(); - @Before + @BeforeEach public void setup() { this.userService.setOauth2UserService(this.oauth2UserService); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserRequestTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserRequestTests.java index af20f2c911..127a68bbbd 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserRequestTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserRequestTests.java @@ -22,8 +22,8 @@ import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; @@ -49,7 +49,7 @@ public class OidcUserRequestTests { private Map additionalParameters; - @Before + @BeforeEach public void setUp() { this.clientRegistration = TestClientRegistrations.clientRegistration().build(); this.accessToken = new OAuth2AccessToken(OAuth2AccessToken.TokenType.BEARER, "access-token-1234", Instant.now(), diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserRequestUtilsTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserRequestUtilsTests.java index 045ac4a3f5..32fb23b5c9 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserRequestUtilsTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserRequestUtilsTests.java @@ -20,7 +20,7 @@ import java.time.Duration; import java.time.Instant; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.TestClientRegistrations; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserServiceTests.java index bc1a4fd6f2..152f77295a 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserServiceTests.java @@ -27,9 +27,9 @@ import java.util.function.Function; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.http.HttpHeaders; @@ -78,7 +78,7 @@ public class OidcUserServiceTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -93,7 +93,7 @@ public class OidcUserServiceTests { this.userService.setOauth2UserService(new DefaultOAuth2UserService()); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/web/logout/OidcClientInitiatedLogoutSuccessHandlerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/web/logout/OidcClientInitiatedLogoutSuccessHandlerTests.java index f63e63da0f..b5ca968f99 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/web/logout/OidcClientInitiatedLogoutSuccessHandlerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/web/logout/OidcClientInitiatedLogoutSuccessHandlerTests.java @@ -22,10 +22,10 @@ import java.util.Collections; import javax.servlet.ServletException; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -46,7 +46,7 @@ import static org.mockito.Mockito.mock; /** * Tests for {@link OidcClientInitiatedLogoutSuccessHandler} */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OidcClientInitiatedLogoutSuccessHandlerTests { // @formatter:off @@ -64,7 +64,7 @@ public class OidcClientInitiatedLogoutSuccessHandlerTests { OidcClientInitiatedLogoutSuccessHandler handler; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/web/server/logout/OidcClientInitiatedServerLogoutSuccessHandlerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/web/server/logout/OidcClientInitiatedServerLogoutSuccessHandlerTests.java index 5714c5f4c1..2a28fea70a 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/web/server/logout/OidcClientInitiatedServerLogoutSuccessHandlerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/web/server/logout/OidcClientInitiatedServerLogoutSuccessHandlerTests.java @@ -22,8 +22,8 @@ import java.util.Collections; import javax.servlet.ServletException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -67,7 +67,7 @@ public class OidcClientInitiatedServerLogoutSuccessHandlerTests { OidcClientInitiatedServerLogoutSuccessHandler handler; - @Before + @BeforeEach public void setup() { this.exchange = mock(ServerWebExchange.class); given(this.exchange.getResponse()).willReturn(new MockServerHttpResponse()); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationTests.java index da1a7ae290..5ee2ad432f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationTests.java @@ -23,7 +23,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.AuthenticationMethod; import org.springframework.security.oauth2.core.AuthorizationGrantType; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java index 13e934e1bd..2884f63dda 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTests.java @@ -26,9 +26,9 @@ import okhttp3.mockwebserver.Dispatcher; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -113,7 +113,7 @@ public class ClientRegistrationsTests { private String issuer; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -121,7 +121,7 @@ public class ClientRegistrationsTests { }); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/InMemoryClientRegistrationRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/InMemoryClientRegistrationRepositoryTests.java index ccdbadc198..22bbd91465 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/InMemoryClientRegistrationRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/InMemoryClientRegistrationRepositoryTests.java @@ -22,7 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/InMemoryReactiveClientRegistrationRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/InMemoryReactiveClientRegistrationRepositoryTests.java index e4ec77190e..4bc83f1679 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/InMemoryReactiveClientRegistrationRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/InMemoryReactiveClientRegistrationRepositoryTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client.registration; import java.util.Arrays; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; import static org.assertj.core.api.Assertions.assertThat; @@ -37,7 +37,7 @@ public class InMemoryReactiveClientRegistrationRepositoryTests { private InMemoryReactiveClientRegistrationRepository repository; - @Before + @BeforeEach public void setup() { this.repository = new InMemoryReactiveClientRegistrationRepository(this.registration); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/CustomUserTypesOAuth2UserServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/CustomUserTypesOAuth2UserServiceTests.java index 9ed6d0b119..87a9a9cbf2 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/CustomUserTypesOAuth2UserServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/CustomUserTypesOAuth2UserServiceTests.java @@ -24,9 +24,9 @@ import java.util.Map; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -60,7 +60,7 @@ public class CustomUserTypesOAuth2UserServiceTests { private MockWebServer server; - @Before + @BeforeEach public void setUp() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -75,7 +75,7 @@ public class CustomUserTypesOAuth2UserServiceTests { this.userService = new CustomUserTypesOAuth2UserService(customUserTypes); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserServiceTests.java index a2df2f4e44..49e2a3c5c7 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserServiceTests.java @@ -24,9 +24,9 @@ import java.util.concurrent.TimeUnit; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.convert.converter.Converter; @@ -72,7 +72,7 @@ public class DefaultOAuth2UserServiceTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -84,7 +84,7 @@ public class DefaultOAuth2UserServiceTests { this.accessToken = TestOAuth2AccessTokens.noScopes(); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultReactiveOAuth2UserServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultReactiveOAuth2UserServiceTests.java index df758645c7..1a215ca8b6 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultReactiveOAuth2UserServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultReactiveOAuth2UserServiceTests.java @@ -27,9 +27,9 @@ import java.util.function.Predicate; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -73,7 +73,7 @@ public class DefaultReactiveOAuth2UserServiceTests { private MockWebServer server; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -84,7 +84,7 @@ public class DefaultReactiveOAuth2UserServiceTests { // @formatter:on } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DelegatingOAuth2UserServiceTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DelegatingOAuth2UserServiceTests.java index ba78eca2fe..f717c9b896 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DelegatingOAuth2UserServiceTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DelegatingOAuth2UserServiceTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.client.userinfo; import java.util.Arrays; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.user.OAuth2User; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/OAuth2UserRequestEntityConverterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/OAuth2UserRequestEntityConverterTests.java index a4f975736f..79d726c2bc 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/OAuth2UserRequestEntityConverterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/OAuth2UserRequestEntityConverterTests.java @@ -20,7 +20,7 @@ import java.time.Instant; import java.util.Arrays; import java.util.LinkedHashSet; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/OAuth2UserRequestTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/OAuth2UserRequestTests.java index e4cbe3fc34..4c8c1c3ebc 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/OAuth2UserRequestTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/OAuth2UserRequestTests.java @@ -22,8 +22,8 @@ import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.core.AuthorizationGrantType; @@ -46,7 +46,7 @@ public class OAuth2UserRequestTests { private Map additionalParameters; - @Before + @BeforeEach public void setUp() { // @formatter:off this.clientRegistration = ClientRegistration.withRegistrationId("registration-1") diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/AuthenticatedPrincipalOAuth2AuthorizedClientRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/AuthenticatedPrincipalOAuth2AuthorizedClientRepositoryTests.java index 88e7c57ade..57ec548b76 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/AuthenticatedPrincipalOAuth2AuthorizedClientRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/AuthenticatedPrincipalOAuth2AuthorizedClientRepositoryTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.web; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -53,7 +53,7 @@ public class AuthenticatedPrincipalOAuth2AuthorizedClientRepositoryTests { private MockHttpServletResponse response; - @Before + @BeforeEach public void setup() { this.authorizedClientService = mock(OAuth2AuthorizedClientService.class); this.anonymousAuthorizedClientRepository = mock(OAuth2AuthorizedClientRepository.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizationRequestResolverTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizationRequestResolverTests.java index 467c3d0301..5c91205e4a 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizationRequestResolverTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizationRequestResolverTests.java @@ -21,8 +21,8 @@ import java.nio.charset.StandardCharsets; import javax.servlet.http.HttpServletRequest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; @@ -67,7 +67,7 @@ public class DefaultOAuth2AuthorizationRequestResolverTests { private DefaultOAuth2AuthorizationRequestResolver resolver; - @Before + @BeforeEach public void setUp() { this.registration1 = TestClientRegistrations.clientRegistration().build(); this.registration2 = TestClientRegistrations.clientRegistration2().build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizedClientManagerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizedClientManagerTests.java index 74ec72f23b..8fe786146f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizedClientManagerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizedClientManagerTests.java @@ -23,8 +23,8 @@ import java.util.function.Function; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.mock.web.MockHttpServletRequest; @@ -95,7 +95,7 @@ public class DefaultOAuth2AuthorizedClientManagerTests { private ArgumentCaptor authorizationContextCaptor; @SuppressWarnings("unchecked") - @Before + @BeforeEach public void setup() { this.clientRegistrationRepository = mock(ClientRegistrationRepository.class); this.authorizedClientRepository = mock(OAuth2AuthorizedClientRepository.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultReactiveOAuth2AuthorizedClientManagerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultReactiveOAuth2AuthorizedClientManagerTests.java index b41e196ba8..c21d405033 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultReactiveOAuth2AuthorizedClientManagerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/DefaultReactiveOAuth2AuthorizedClientManagerTests.java @@ -21,8 +21,8 @@ import java.util.HashMap; import java.util.Map; import java.util.function.Function; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import reactor.core.publisher.Mono; import reactor.test.publisher.PublisherProbe; @@ -97,7 +97,7 @@ public class DefaultReactiveOAuth2AuthorizedClientManagerTests { private PublisherProbe removeAuthorizedClientProbe; @SuppressWarnings("unchecked") - @Before + @BeforeEach public void setup() { this.clientRegistrationRepository = mock(ReactiveClientRegistrationRepository.class); given(this.clientRegistrationRepository.findByRegistrationId(anyString())).willReturn(Mono.empty()); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests.java index 988829dc80..2a55a96a3f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.web; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class HttpSessionOAuth2AuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests extends HttpSessionOAuth2AuthorizationRequestRepositoryTests { - @Before + @BeforeEach public void setup() { this.authorizationRequestRepository = new HttpSessionOAuth2AuthorizationRequestRepository(); this.authorizationRequestRepository.setAllowMultipleAuthorizationRequests(true); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests.java index a9b1ebbe4e..3c2b7a7139 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.web; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class HttpSessionOAuth2AuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests extends HttpSessionOAuth2AuthorizationRequestRepositoryTests { - @Before + @BeforeEach public void setup() { this.authorizationRequestRepository = new HttpSessionOAuth2AuthorizationRequestRepository(); this.authorizationRequestRepository.setAllowMultipleAuthorizationRequests(false); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryTests.java index 02bddaabeb..4bd6e2e2ce 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepositoryTests.java @@ -19,9 +19,9 @@ package org.springframework.security.oauth2.client.web; import java.util.HashMap; import java.util.Map; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException * @author Joe Grandja * @author Craig Andrews */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public abstract class HttpSessionOAuth2AuthorizationRequestRepositoryTests { protected HttpSessionOAuth2AuthorizationRequestRepository authorizationRequestRepository; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizedClientRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizedClientRepositoryTests.java index 42db859732..1054b29beb 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizedClientRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizedClientRepositoryTests.java @@ -20,8 +20,8 @@ import java.util.Map; import javax.servlet.http.HttpSession; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -57,7 +57,7 @@ public class HttpSessionOAuth2AuthorizedClientRepositoryTests { private MockHttpServletResponse response; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationCodeGrantFilterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationCodeGrantFilterTests.java index 20666fa15e..e822c4b932 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationCodeGrantFilterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationCodeGrantFilterTests.java @@ -26,9 +26,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -95,7 +95,7 @@ public class OAuth2AuthorizationCodeGrantFilterTests { private OAuth2AuthorizationCodeGrantFilter filter; - @Before + @BeforeEach public void setup() { this.registration1 = TestClientRegistrations.clientRegistration().build(); this.clientRegistrationRepository = new InMemoryClientRegistrationRepository(this.registration1); @@ -114,7 +114,7 @@ public class OAuth2AuthorizationCodeGrantFilterTests { SecurityContextHolder.setContext(securityContext); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } 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 4d3dedacb4..0df8ea1a03 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 @@ -27,8 +27,8 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletRequest; @@ -73,7 +73,7 @@ public class OAuth2AuthorizationRequestRedirectFilterTests { private RequestCache requestCache; - @Before + @BeforeEach public void setUp() { this.registration1 = TestClientRegistrations.clientRegistration().build(); this.registration2 = TestClientRegistrations.clientRegistration2().build(); 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 2bbb1840da..411b8573ae 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 @@ -23,8 +23,8 @@ import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.mock.web.MockHttpServletRequest; @@ -99,7 +99,7 @@ public class OAuth2LoginAuthenticationFilterTests { private OAuth2LoginAuthenticationFilter filter; - @Before + @BeforeEach public void setUp() { this.registration1 = TestClientRegistrations.clientRegistration().build(); this.registration2 = TestClientRegistrations.clientRegistration2().build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/method/annotation/OAuth2AuthorizedClientArgumentResolverTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/method/annotation/OAuth2AuthorizedClientArgumentResolverTests.java index e3cfc3d8c4..1e83a645f9 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/method/annotation/OAuth2AuthorizedClientArgumentResolverTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/method/annotation/OAuth2AuthorizedClientArgumentResolverTests.java @@ -23,9 +23,9 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.MethodParameter; import org.springframework.mock.web.MockHttpServletRequest; @@ -104,7 +104,7 @@ public class OAuth2AuthorizedClientArgumentResolverTests { private MockHttpServletResponse response; - @Before + @BeforeEach public void setup() { this.authentication = new TestingAuthenticationToken(this.principalName, "password"); SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); @@ -157,7 +157,7 @@ public class OAuth2AuthorizedClientArgumentResolverTests { this.response = new MockHttpServletResponse(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionITests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionITests.java index 9b501a6e63..7e86f68ce2 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionITests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionITests.java @@ -23,9 +23,9 @@ import java.util.HashSet; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import reactor.core.publisher.Mono; import reactor.util.context.Context; @@ -86,7 +86,7 @@ public class ServerOAuth2AuthorizedClientExchangeFilterFunctionITests { private MockServerWebExchange exchange; - @Before + @BeforeEach public void setUp() throws Exception { this.clientRegistrationRepository = mock(ReactiveClientRegistrationRepository.class); final ServerOAuth2AuthorizedClientRepository delegate = new AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository( @@ -124,7 +124,7 @@ public class ServerOAuth2AuthorizedClientExchangeFilterFunctionITests { this.exchange = MockServerWebExchange.builder(MockServerHttpRequest.get("/").build()).build(); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } 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 7bc1877cf3..54c13f5e68 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 @@ -27,13 +27,13 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.publisher.PublisherProbe; import reactor.util.context.Context; @@ -113,7 +113,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServerOAuth2AuthorizedClientExchangeFilterFunctionTests { @Mock @@ -159,7 +159,7 @@ public class ServerOAuth2AuthorizedClientExchangeFilterFunctionTests { private DefaultReactiveOAuth2AuthorizedClientManager authorizedClientManager; - @Before + @BeforeEach public void setup() { // @formatter:off ReactiveOAuth2AuthorizedClientProvider authorizedClientProvider = ReactiveOAuth2AuthorizedClientProviderBuilder diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunctionITests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunctionITests.java index c2cb2070e8..d0a0b8e730 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunctionITests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunctionITests.java @@ -28,10 +28,10 @@ import javax.servlet.http.HttpServletResponse; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import reactor.blockhound.BlockHound; import reactor.util.context.Context; @@ -89,7 +89,7 @@ public class ServletOAuth2AuthorizedClientExchangeFilterFunctionITests { private MockHttpServletResponse response; - @BeforeClass + @BeforeAll public static void setUpBlockingChecks() { // IMPORTANT: // Before enabling BlockHound, we need to white-list @@ -106,7 +106,7 @@ public class ServletOAuth2AuthorizedClientExchangeFilterFunctionITests { // @formatter:on } - @Before + @BeforeEach public void setUp() throws Exception { this.clientRegistrationRepository = mock(ClientRegistrationRepository.class); final OAuth2AuthorizedClientRepository delegate = new AuthenticatedPrincipalOAuth2AuthorizedClientRepository( @@ -143,7 +143,7 @@ public class ServletOAuth2AuthorizedClientExchangeFilterFunctionITests { RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(this.request, this.response)); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); SecurityContextHolder.clearContext(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunctionTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunctionTests.java index 05b1d8422f..849a173ebf 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunctionTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunctionTests.java @@ -31,14 +31,14 @@ import java.util.function.Consumer; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.util.context.Context; @@ -127,7 +127,7 @@ import static org.mockito.Mockito.verifyNoInteractions; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServletOAuth2AuthorizedClientExchangeFilterFunctionTests { @Mock @@ -187,7 +187,7 @@ public class ServletOAuth2AuthorizedClientExchangeFilterFunctionTests { private OAuth2AccessToken accessToken = new OAuth2AccessToken(OAuth2AccessToken.TokenType.BEARER, "token-0", Instant.now(), Instant.now().plus(Duration.ofDays(1))); - @Before + @BeforeEach public void setup() { this.authentication = new TestingAuthenticationToken("test", "this"); JwtBearerOAuth2AuthorizedClientProvider jwtBearerAuthorizedClientProvider = new JwtBearerOAuth2AuthorizedClientProvider(); @@ -209,7 +209,7 @@ public class ServletOAuth2AuthorizedClientExchangeFilterFunctionTests { this.function = new ServletOAuth2AuthorizedClientExchangeFilterFunction(this.authorizedClientManager); } - @After + @AfterEach public void cleanup() throws Exception { SecurityContextHolder.clearContext(); RequestContextHolder.resetRequestAttributes(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/result/method/annotation/OAuth2AuthorizedClientArgumentResolverTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/result/method/annotation/OAuth2AuthorizedClientArgumentResolverTests.java index cae90564be..1c01827d90 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/result/method/annotation/OAuth2AuthorizedClientArgumentResolverTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/reactive/result/method/annotation/OAuth2AuthorizedClientArgumentResolverTests.java @@ -18,11 +18,11 @@ package org.springframework.security.oauth2.client.web.reactive.result.method.an import java.lang.reflect.Method; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.util.context.Context; @@ -59,7 +59,7 @@ import static org.mockito.Mockito.mock; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OAuth2AuthorizedClientArgumentResolverTests { @Mock @@ -78,7 +78,7 @@ public class OAuth2AuthorizedClientArgumentResolverTests { private Authentication authentication = new TestingAuthenticationToken("test", "this"); - @Before + @BeforeEach public void setUp() { // @formatter:off ReactiveOAuth2AuthorizedClientProvider authorizedClientProvider = ReactiveOAuth2AuthorizedClientProviderBuilder diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/AuthenticatedPrincipalServerOAuth2AuthorizedClientRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/AuthenticatedPrincipalServerOAuth2AuthorizedClientRepositoryTests.java index 9693d71749..b6089d75a0 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/AuthenticatedPrincipalServerOAuth2AuthorizedClientRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/AuthenticatedPrincipalServerOAuth2AuthorizedClientRepositoryTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.web.server; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -53,7 +53,7 @@ public class AuthenticatedPrincipalServerOAuth2AuthorizedClientRepositoryTests { private MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")); - @Before + @BeforeEach public void setup() { this.authorizedClientService = mock(ReactiveOAuth2AuthorizedClientService.class); this.anonymousAuthorizedClientRepository = mock(ServerOAuth2AuthorizedClientRepository.class); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/DefaultServerOAuth2AuthorizationRequestResolverTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/DefaultServerOAuth2AuthorizationRequestResolverTests.java index ecccefbb43..0762eba0b6 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/DefaultServerOAuth2AuthorizationRequestResolverTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/DefaultServerOAuth2AuthorizationRequestResolverTests.java @@ -16,11 +16,11 @@ package org.springframework.security.oauth2.client.web.server; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.http.HttpStatus; @@ -48,7 +48,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DefaultServerOAuth2AuthorizationRequestResolverTests { @Mock @@ -58,7 +58,7 @@ public class DefaultServerOAuth2AuthorizationRequestResolverTests { private ClientRegistration registration = TestClientRegistrations.clientRegistration().build(); - @Before + @BeforeEach public void setup() { this.resolver = new DefaultServerOAuth2AuthorizationRequestResolver(this.clientRegistrationRepository); } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/OAuth2AuthorizationCodeGrantWebFilterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/OAuth2AuthorizationCodeGrantWebFilterTests.java index b474ce8a9f..9fcb151bbb 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/OAuth2AuthorizationCodeGrantWebFilterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/OAuth2AuthorizationCodeGrantWebFilterTests.java @@ -22,11 +22,11 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -63,7 +63,7 @@ import static org.mockito.Mockito.verifyNoInteractions; * @author Parikshit Dutta * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OAuth2AuthorizationCodeGrantWebFilterTests { private OAuth2AuthorizationCodeGrantWebFilter filter; @@ -80,7 +80,7 @@ public class OAuth2AuthorizationCodeGrantWebFilterTests { @Mock private ServerAuthorizationRequestRepository authorizationRequestRepository; - @Before + @BeforeEach public void setup() { this.filter = new OAuth2AuthorizationCodeGrantWebFilter(this.authenticationManager, this.clientRegistrationRepository, this.authorizedClientRepository); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/OAuth2AuthorizationRequestRedirectWebFilterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/OAuth2AuthorizationRequestRedirectWebFilterTests.java index 448425169e..045dc2ea8c 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/OAuth2AuthorizationRequestRedirectWebFilterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/OAuth2AuthorizationRequestRedirectWebFilterTests.java @@ -19,11 +19,11 @@ package org.springframework.security.oauth2.client.web.server; import java.net.URI; import java.util.Arrays; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.security.oauth2.client.ClientAuthorizationRequiredException; @@ -47,7 +47,7 @@ import static org.mockito.Mockito.verifyNoInteractions; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OAuth2AuthorizationRequestRedirectWebFilterTests { @Mock @@ -65,7 +65,7 @@ public class OAuth2AuthorizationRequestRedirectWebFilterTests { private WebTestClient client; - @Before + @BeforeEach public void setup() { this.filter = new OAuth2AuthorizationRequestRedirectWebFilter(this.clientRepository); this.filter.setAuthorizationRequestRepository(this.authzRequestRepository); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/ServerOAuth2AuthorizationCodeAuthenticationTokenConverterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/ServerOAuth2AuthorizationCodeAuthenticationTokenConverterTests.java index 5053362627..9f9c4b70ce 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/ServerOAuth2AuthorizationCodeAuthenticationTokenConverterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/ServerOAuth2AuthorizationCodeAuthenticationTokenConverterTests.java @@ -19,11 +19,11 @@ package org.springframework.security.oauth2.client.web.server; import java.util.Collections; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -47,7 +47,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServerOAuth2AuthorizationCodeAuthenticationTokenConverterTests { @Mock @@ -87,7 +87,7 @@ public class ServerOAuth2AuthorizationCodeAuthenticationTokenConverterTests { private ServerOAuth2AuthorizationCodeAuthenticationTokenConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new ServerOAuth2AuthorizationCodeAuthenticationTokenConverter( this.clientRegistrationRepository); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/UnAuthenticatedServerOAuth2AuthorizedClientRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/UnAuthenticatedServerOAuth2AuthorizedClientRepositoryTests.java index 308c5f03db..0478e64303 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/UnAuthenticatedServerOAuth2AuthorizedClientRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/UnAuthenticatedServerOAuth2AuthorizedClientRepositoryTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.client.web.server; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.web.server.MockServerWebExchange; @@ -55,7 +55,7 @@ public class UnAuthenticatedServerOAuth2AuthorizedClientRepositoryTests { private OAuth2AuthorizedClient authorizedClient; - @Before + @BeforeEach public void setup() { OAuth2AccessToken token = TestOAuth2AccessTokens.noScopes(); this.authorizedClient = new OAuth2AuthorizedClient(this.clientRegistration, "anonymousUser", token); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests.java index 5b3a014bf6..a13374e25e 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client.web.server; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -54,7 +54,7 @@ import static org.mockito.Mockito.verify; public class WebSessionOAuth2ServerAuthorizationRequestRepositoryAllowMultipleAuthorizationRequestsTests extends WebSessionOAuth2ServerAuthorizationRequestRepositoryTests { - @Before + @BeforeEach public void setup() { this.repository = new WebSessionOAuth2ServerAuthorizationRequestRepository(); this.repository.setAllowMultipleAuthorizationRequests(true); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests.java index 5e60fd298f..f769d2c8ac 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.client.web.server; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -54,7 +54,7 @@ import static org.mockito.Mockito.verify; public class WebSessionOAuth2ServerAuthorizationRequestRepositoryDoNotAllowMultipleAuthorizationRequestsTests extends WebSessionOAuth2ServerAuthorizationRequestRepositoryTests { - @Before + @BeforeEach public void setup() { this.repository = new WebSessionOAuth2ServerAuthorizationRequestRepository(); this.repository.setAllowMultipleAuthorizationRequests(false); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryTests.java index c3470b68a2..4549f93b72 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionOAuth2ServerAuthorizationRequestRepositoryTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.client.web.server; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionServerOAuth2AuthorizedClientRepositoryTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionServerOAuth2AuthorizedClientRepositoryTests.java index d0bd471407..1dbf855eac 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionServerOAuth2AuthorizedClientRepositoryTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/WebSessionServerOAuth2AuthorizedClientRepositoryTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.client.web.server; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.web.server.MockServerWebExchange; diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/authentication/OAuth2LoginAuthenticationWebFilterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/authentication/OAuth2LoginAuthenticationWebFilterTests.java index 6c89588554..a326bcc994 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/authentication/OAuth2LoginAuthenticationWebFilterTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/server/authentication/OAuth2LoginAuthenticationWebFilterTests.java @@ -20,11 +20,11 @@ import java.time.Duration; import java.time.Instant; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -51,7 +51,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OAuth2LoginAuthenticationWebFilterTests { @Mock @@ -69,7 +69,7 @@ public class OAuth2LoginAuthenticationWebFilterTests { private OAuth2AuthorizationResponse.Builder authorizationResponseBldr = OAuth2AuthorizationResponse.success("code") .state("state"); - @Before + @BeforeEach public void setup() { this.filter = new OAuth2LoginAuthenticationWebFilter(this.authenticationManager, this.authorizedClientRepository); diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/AuthenticationMethodTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/AuthenticationMethodTests.java index 2b4af49903..7e3b26cac2 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/AuthenticationMethodTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/AuthenticationMethodTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/AuthorizationGrantTypeTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/AuthorizationGrantTypeTests.java index 57fc6d05a1..dfbeb1c7d9 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/AuthorizationGrantTypeTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/AuthorizationGrantTypeTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClaimAccessorTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClaimAccessorTests.java index e0c1524dc7..f1f50836c2 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClaimAccessorTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClaimAccessorTests.java @@ -23,8 +23,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatObject; @@ -40,7 +40,7 @@ public class ClaimAccessorTests { private ClaimAccessor claimAccessor = (() -> this.claims); - @Before + @BeforeEach public void setup() { this.claims.clear(); } diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClientAuthenticationMethodTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClientAuthenticationMethodTests.java index f008049170..3ae9a181f8 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClientAuthenticationMethodTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/ClientAuthenticationMethodTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/DefaultOAuth2AuthenticatedPrincipalTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/DefaultOAuth2AuthenticatedPrincipalTests.java index 5a1940c945..c619e6f318 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/DefaultOAuth2AuthenticatedPrincipalTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/DefaultOAuth2AuthenticatedPrincipalTests.java @@ -20,7 +20,7 @@ import java.util.Collection; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/DelegatingOAuth2TokenValidatorTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/DelegatingOAuth2TokenValidatorTests.java index ce4fa6b365..82aa06722b 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/DelegatingOAuth2TokenValidatorTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/DelegatingOAuth2TokenValidatorTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.core; import java.util.Arrays; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2AccessTokenTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2AccessTokenTests.java index 13fb265cf6..223f1006a8 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2AccessTokenTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2AccessTokenTests.java @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.util.SerializationUtils; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2ErrorTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2ErrorTests.java index e54ae5419f..b1ea037e1c 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2ErrorTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2ErrorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2RefreshTokenTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2RefreshTokenTests.java index 67b1f88dca..0d5bb17329 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2RefreshTokenTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2RefreshTokenTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.core; import java.time.Instant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2TokenValidatorResultTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2TokenValidatorResultTests.java index e1aae08a90..fc744d190b 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2TokenValidatorResultTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/OAuth2TokenValidatorResultTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/converter/ClaimConversionServiceTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/converter/ClaimConversionServiceTests.java index f77687a428..491e7a2a3c 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/converter/ClaimConversionServiceTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/converter/ClaimConversionServiceTests.java @@ -29,7 +29,7 @@ import java.util.Map; import com.nimbusds.jose.shaded.json.JSONArray; import com.nimbusds.jose.shaded.json.JSONObject; import org.assertj.core.util.Lists; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.ConversionService; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/converter/ClaimTypeConverterTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/converter/ClaimTypeConverterTests.java index 2a1f329df1..586ab8653a 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/converter/ClaimTypeConverterTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/converter/ClaimTypeConverterTests.java @@ -27,8 +27,8 @@ import com.nimbusds.jose.shaded.json.JSONArray; import com.nimbusds.jose.shaded.json.JSONObject; import org.assertj.core.util.Lists; import org.assertj.core.util.Maps; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.converter.Converter; @@ -64,7 +64,7 @@ public class ClaimTypeConverterTests { private ClaimTypeConverter claimTypeConverter; - @Before + @BeforeEach @SuppressWarnings("unchecked") public void setup() { Converter stringConverter = getConverter(TypeDescriptor.valueOf(String.class)); diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/DefaultMapOAuth2AccessTokenResponseConverterTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/DefaultMapOAuth2AccessTokenResponseConverterTests.java index c4064c6efb..47a73260b9 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/DefaultMapOAuth2AccessTokenResponseConverterTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/DefaultMapOAuth2AccessTokenResponseConverterTests.java @@ -22,9 +22,9 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.security.oauth2.core.OAuth2AccessToken; @@ -39,7 +39,7 @@ public class DefaultMapOAuth2AccessTokenResponseConverterTests { private Converter, OAuth2AccessTokenResponse> messageConverter; - @Before + @BeforeEach public void setup() { this.messageConverter = new DefaultMapOAuth2AccessTokenResponseConverter(); } @@ -56,23 +56,23 @@ public class DefaultMapOAuth2AccessTokenResponseConverterTests { map.put("custom_parameter_2", "custom-value-2"); OAuth2AccessTokenResponse converted = this.messageConverter.convert(map); OAuth2AccessToken accessToken = converted.getAccessToken(); - Assert.assertNotNull(accessToken); - Assert.assertEquals("access-token-1234", accessToken.getTokenValue()); - Assert.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); + Assertions.assertNotNull(accessToken); + Assertions.assertEquals("access-token-1234", accessToken.getTokenValue()); + Assertions.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); Set scopes = accessToken.getScopes(); - Assert.assertNotNull(scopes); - Assert.assertEquals(2, scopes.size()); - Assert.assertTrue(scopes.contains("read")); - Assert.assertTrue(scopes.contains("write")); - Assert.assertEquals(3600, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); + Assertions.assertNotNull(scopes); + Assertions.assertEquals(2, scopes.size()); + Assertions.assertTrue(scopes.contains("read")); + Assertions.assertTrue(scopes.contains("write")); + Assertions.assertEquals(3600, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); OAuth2RefreshToken refreshToken = converted.getRefreshToken(); - Assert.assertNotNull(refreshToken); - Assert.assertEquals("refresh-token-1234", refreshToken.getTokenValue()); + Assertions.assertNotNull(refreshToken); + Assertions.assertEquals("refresh-token-1234", refreshToken.getTokenValue()); Map additionalParameters = converted.getAdditionalParameters(); - Assert.assertNotNull(additionalParameters); - Assert.assertEquals(2, additionalParameters.size()); - Assert.assertEquals("custom-value-1", additionalParameters.get("custom_parameter_1")); - Assert.assertEquals("custom-value-2", additionalParameters.get("custom_parameter_2")); + Assertions.assertNotNull(additionalParameters); + Assertions.assertEquals(2, additionalParameters.size()); + Assertions.assertEquals("custom-value-1", additionalParameters.get("custom_parameter_1")); + Assertions.assertEquals("custom-value-2", additionalParameters.get("custom_parameter_2")); } @Test @@ -82,18 +82,18 @@ public class DefaultMapOAuth2AccessTokenResponseConverterTests { map.put("token_type", "bearer"); OAuth2AccessTokenResponse converted = this.messageConverter.convert(map); OAuth2AccessToken accessToken = converted.getAccessToken(); - Assert.assertNotNull(accessToken); - Assert.assertEquals("access-token-1234", accessToken.getTokenValue()); - Assert.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); + Assertions.assertNotNull(accessToken); + Assertions.assertEquals("access-token-1234", accessToken.getTokenValue()); + Assertions.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); Set scopes = accessToken.getScopes(); - Assert.assertNotNull(scopes); - Assert.assertEquals(0, scopes.size()); - Assert.assertEquals(1, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); + Assertions.assertNotNull(scopes); + Assertions.assertEquals(0, scopes.size()); + Assertions.assertEquals(1, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); OAuth2RefreshToken refreshToken = converted.getRefreshToken(); - Assert.assertNull(refreshToken); + Assertions.assertNull(refreshToken); Map additionalParameters = converted.getAdditionalParameters(); - Assert.assertNotNull(additionalParameters); - Assert.assertEquals(0, additionalParameters.size()); + Assertions.assertNotNull(additionalParameters); + Assertions.assertEquals(0, additionalParameters.size()); } @Test @@ -104,18 +104,18 @@ public class DefaultMapOAuth2AccessTokenResponseConverterTests { map.put("expires_in", "2100-01-01-abc"); OAuth2AccessTokenResponse converted = this.messageConverter.convert(map); OAuth2AccessToken accessToken = converted.getAccessToken(); - Assert.assertNotNull(accessToken); - Assert.assertEquals("access-token-1234", accessToken.getTokenValue()); - Assert.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); + Assertions.assertNotNull(accessToken); + Assertions.assertEquals("access-token-1234", accessToken.getTokenValue()); + Assertions.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); Set scopes = accessToken.getScopes(); - Assert.assertNotNull(scopes); - Assert.assertEquals(0, scopes.size()); - Assert.assertEquals(1, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); + Assertions.assertNotNull(scopes); + Assertions.assertEquals(0, scopes.size()); + Assertions.assertEquals(1, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); OAuth2RefreshToken refreshToken = converted.getRefreshToken(); - Assert.assertNull(refreshToken); + Assertions.assertNull(refreshToken); Map additionalParameters = converted.getAdditionalParameters(); - Assert.assertNotNull(additionalParameters); - Assert.assertEquals(0, additionalParameters.size()); + Assertions.assertNotNull(additionalParameters); + Assertions.assertEquals(0, additionalParameters.size()); } // gh-9685 @@ -127,10 +127,10 @@ public class DefaultMapOAuth2AccessTokenResponseConverterTests { map.put("expires_in", 3600); OAuth2AccessTokenResponse converted = this.messageConverter.convert(map); OAuth2AccessToken accessToken = converted.getAccessToken(); - Assert.assertNotNull(accessToken); - Assert.assertEquals("access-token-1234", accessToken.getTokenValue()); - Assert.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); - Assert.assertEquals(3600, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); + Assertions.assertNotNull(accessToken); + Assertions.assertEquals("access-token-1234", accessToken.getTokenValue()); + Assertions.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); + Assertions.assertEquals(3600, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); } // gh-9685 @@ -149,23 +149,23 @@ public class DefaultMapOAuth2AccessTokenResponseConverterTests { map.put("custom_parameter_2", "custom-value-2"); OAuth2AccessTokenResponse converted = this.messageConverter.convert(map); OAuth2AccessToken accessToken = converted.getAccessToken(); - Assert.assertNotNull(accessToken); - Assert.assertEquals("access-token-1234", accessToken.getTokenValue()); - Assert.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); + Assertions.assertNotNull(accessToken); + Assertions.assertEquals("access-token-1234", accessToken.getTokenValue()); + Assertions.assertEquals(OAuth2AccessToken.TokenType.BEARER, accessToken.getTokenType()); Set scopes = accessToken.getScopes(); - Assert.assertNotNull(scopes); - Assert.assertEquals(2, scopes.size()); - Assert.assertTrue(scopes.contains("read")); - Assert.assertTrue(scopes.contains("write")); - Assert.assertEquals(3600, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); + Assertions.assertNotNull(scopes); + Assertions.assertEquals(2, scopes.size()); + Assertions.assertTrue(scopes.contains("read")); + Assertions.assertTrue(scopes.contains("write")); + Assertions.assertEquals(3600, Duration.between(accessToken.getIssuedAt(), accessToken.getExpiresAt()).getSeconds()); OAuth2RefreshToken refreshToken = converted.getRefreshToken(); - Assert.assertNotNull(refreshToken); - Assert.assertEquals("refresh-token-1234", refreshToken.getTokenValue()); + Assertions.assertNotNull(refreshToken); + Assertions.assertEquals("refresh-token-1234", refreshToken.getTokenValue()); Map additionalParameters = converted.getAdditionalParameters(); - Assert.assertNotNull(additionalParameters); - Assert.assertEquals(2, additionalParameters.size()); - Assert.assertEquals(nestedObject, additionalParameters.get("custom_parameter_1")); - Assert.assertEquals("custom-value-2", additionalParameters.get("custom_parameter_2")); + Assertions.assertNotNull(additionalParameters); + Assertions.assertEquals(2, additionalParameters.size()); + Assertions.assertEquals(nestedObject, additionalParameters.get("custom_parameter_1")); + Assertions.assertEquals("custom-value-2", additionalParameters.get("custom_parameter_2")); } } diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/DefaultOAuth2AccessTokenResponseMapConverterTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/DefaultOAuth2AccessTokenResponseMapConverterTests.java index 0446e73aac..0d58ddaea4 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/DefaultOAuth2AccessTokenResponseMapConverterTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/DefaultOAuth2AccessTokenResponseMapConverterTests.java @@ -22,9 +22,9 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.security.oauth2.core.OAuth2AccessToken; @@ -38,7 +38,7 @@ public class DefaultOAuth2AccessTokenResponseMapConverterTests { private Converter> messageConverter; - @Before + @BeforeEach public void setup() { this.messageConverter = new DefaultOAuth2AccessTokenResponseMapConverter(); } @@ -61,14 +61,14 @@ public class DefaultOAuth2AccessTokenResponseMapConverterTests { .build(); // @formatter:on Map result = this.messageConverter.convert(build); - Assert.assertEquals(7, result.size()); - Assert.assertEquals("access-token-value-1234", result.get("access_token")); - Assert.assertEquals("refresh-token-value-1234", result.get("refresh_token")); - Assert.assertEquals("read write", result.get("scope")); - Assert.assertEquals("Bearer", result.get("token_type")); - Assert.assertNotNull(result.get("expires_in")); - Assert.assertEquals("custom-value-1", result.get("custom_parameter_1")); - Assert.assertEquals("custom-value-2", result.get("custom_parameter_2")); + Assertions.assertEquals(7, result.size()); + Assertions.assertEquals("access-token-value-1234", result.get("access_token")); + Assertions.assertEquals("refresh-token-value-1234", result.get("refresh_token")); + Assertions.assertEquals("read write", result.get("scope")); + Assertions.assertEquals("Bearer", result.get("token_type")); + Assertions.assertNotNull(result.get("expires_in")); + Assertions.assertEquals("custom-value-1", result.get("custom_parameter_1")); + Assertions.assertEquals("custom-value-2", result.get("custom_parameter_2")); } @Test @@ -79,10 +79,10 @@ public class DefaultOAuth2AccessTokenResponseMapConverterTests { .build(); // @formatter:on Map result = this.messageConverter.convert(build); - Assert.assertEquals(3, result.size()); - Assert.assertEquals("access-token-value-1234", result.get("access_token")); - Assert.assertEquals("Bearer", result.get("token_type")); - Assert.assertNotNull(result.get("expires_in")); + Assertions.assertEquals(3, result.size()); + Assertions.assertEquals("access-token-value-1234", result.get("access_token")); + Assertions.assertEquals("Bearer", result.get("token_type")); + Assertions.assertNotNull(result.get("expires_in")); } // gh-9685 @@ -107,14 +107,14 @@ public class DefaultOAuth2AccessTokenResponseMapConverterTests { .build(); // @formatter:on Map result = this.messageConverter.convert(build); - Assert.assertEquals(7, result.size()); - Assert.assertEquals("access-token-value-1234", result.get("access_token")); - Assert.assertEquals("refresh-token-value-1234", result.get("refresh_token")); - Assert.assertEquals("read write", result.get("scope")); - Assert.assertEquals("Bearer", result.get("token_type")); - Assert.assertNotNull(result.get("expires_in")); - Assert.assertEquals(nestedObject, result.get("custom_parameter_1")); - Assert.assertEquals("custom-value-2", result.get("custom_parameter_2")); + Assertions.assertEquals(7, result.size()); + Assertions.assertEquals("access-token-value-1234", result.get("access_token")); + Assertions.assertEquals("refresh-token-value-1234", result.get("refresh_token")); + Assertions.assertEquals("read write", result.get("scope")); + Assertions.assertEquals("Bearer", result.get("token_type")); + Assertions.assertNotNull(result.get("expires_in")); + Assertions.assertEquals(nestedObject, result.get("custom_parameter_1")); + Assertions.assertEquals("custom-value-2", result.get("custom_parameter_2")); } } diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AccessTokenResponseTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AccessTokenResponseTests.java index 8783e29aa3..bc2cdba8a0 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AccessTokenResponseTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AccessTokenResponseTests.java @@ -23,7 +23,7 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.OAuth2AccessToken; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationExchangeTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationExchangeTests.java index 6224249d42..bdb78830e6 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationExchangeTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationExchangeTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core.endpoint; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequestTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequestTests.java index ddb69f6527..0101ecae59 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequestTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequestTests.java @@ -23,7 +23,7 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.AuthorizationGrantType; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseTests.java index 93dbea3424..43fc8dcca0 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core.endpoint; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseTypeTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseTypeTests.java index 238ddc6e3b..0f8371d0cb 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseTypeTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseTypeTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core.endpoint; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/http/converter/OAuth2AccessTokenResponseHttpMessageConverterTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/http/converter/OAuth2AccessTokenResponseHttpMessageConverterTests.java index f51327cc04..842ea51181 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/http/converter/OAuth2AccessTokenResponseHttpMessageConverterTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/http/converter/OAuth2AccessTokenResponseHttpMessageConverterTests.java @@ -24,8 +24,8 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.http.HttpStatus; @@ -53,7 +53,7 @@ public class OAuth2AccessTokenResponseHttpMessageConverterTests { private OAuth2AccessTokenResponseHttpMessageConverter messageConverter; - @Before + @BeforeEach public void setup() { this.messageConverter = new OAuth2AccessTokenResponseHttpMessageConverter(); } diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/http/converter/OAuth2ErrorHttpMessageConverterTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/http/converter/OAuth2ErrorHttpMessageConverterTests.java index 35e697fdf6..90aa2de2e4 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/http/converter/OAuth2ErrorHttpMessageConverterTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/http/converter/OAuth2ErrorHttpMessageConverterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.core.http.converter; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.http.HttpStatus; @@ -43,7 +43,7 @@ public class OAuth2ErrorHttpMessageConverterTests { private OAuth2ErrorHttpMessageConverter messageConverter; - @Before + @BeforeEach public void setup() { this.messageConverter = new OAuth2ErrorHttpMessageConverter(); } diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/DefaultAddressStandardClaimTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/DefaultAddressStandardClaimTests.java index d85fd854af..a121a68094 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/DefaultAddressStandardClaimTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/DefaultAddressStandardClaimTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.core.oidc; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcIdTokenBuilderTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcIdTokenBuilderTests.java index 56d8f7e48c..2027f75196 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcIdTokenBuilderTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcIdTokenBuilderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.core.oidc; import java.time.Instant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcIdTokenTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcIdTokenTests.java index aa4d5ad604..3291142c1b 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcIdTokenTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcIdTokenTests.java @@ -23,7 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcUserInfoBuilderTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcUserInfoBuilderTests.java index b7e02d0ed8..50d7f56b1c 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcUserInfoBuilderTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcUserInfoBuilderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.core.oidc; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcUserInfoTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcUserInfoTests.java index 31d8ecd064..463278f485 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcUserInfoTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/OidcUserInfoTests.java @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/DefaultOidcUserTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/DefaultOidcUserTests.java index a928dc0fbc..4c4ae82500 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/DefaultOidcUserTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/DefaultOidcUserTests.java @@ -22,7 +22,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/OidcUserAuthorityTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/OidcUserAuthorityTests.java index 16ca01f0f6..369e0c91d1 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/OidcUserAuthorityTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/OidcUserAuthorityTests.java @@ -20,7 +20,7 @@ import java.time.Instant; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.oidc.IdTokenClaimNames; import org.springframework.security.oauth2.core.oidc.OidcIdToken; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/DefaultOAuth2UserTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/DefaultOAuth2UserTests.java index 5ba71e4fb7..9f37b7630e 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/DefaultOAuth2UserTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/DefaultOAuth2UserTests.java @@ -20,7 +20,7 @@ import java.util.Collections; import java.util.Map; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/OAuth2UserAuthorityTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/OAuth2UserAuthorityTests.java index b3abe28ae1..4b59b143fb 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/OAuth2UserAuthorityTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/OAuth2UserAuthorityTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.core.user; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/web/reactive/function/OAuth2BodyExtractorsTests.java b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/web/reactive/function/OAuth2BodyExtractorsTests.java index baf82a016b..0d0eb9adb1 100644 --- a/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/web/reactive/function/OAuth2BodyExtractorsTests.java +++ b/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/web/reactive/function/OAuth2BodyExtractorsTests.java @@ -23,8 +23,8 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.core.codec.ByteBufferDecoder; @@ -56,7 +56,7 @@ public class OAuth2BodyExtractorsTests { private Map hints; - @Before + @BeforeEach public void createContext() { final List> messageReaders = new ArrayList<>(); messageReaders.add(new DecoderHttpMessageReader<>(new ByteBufferDecoder())); diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/jws/MacAlgorithmTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/jws/MacAlgorithmTests.java index e3435cf5c2..b99a97761e 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/jws/MacAlgorithmTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/jws/MacAlgorithmTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.jose.jws; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/jws/SignatureAlgorithmTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/jws/SignatureAlgorithmTests.java index 99b01996fd..edd198be27 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/jws/SignatureAlgorithmTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/jws/SignatureAlgorithmTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.jose.jws; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtBuilderTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtBuilderTests.java index 0aaf02945e..4d521ed906 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtBuilderTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtBuilderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.jwt; import java.time.Instant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtClaimValidatorTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtClaimValidatorTests.java index 820d73e322..430f707892 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtClaimValidatorTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtClaimValidatorTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.jwt; import java.util.function.Predicate; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtilsTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtilsTests.java index 6f70dcf1d1..b51bcbb9ce 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtilsTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtilsTests.java @@ -30,7 +30,7 @@ import com.nimbusds.jose.jwk.RSAKey; import com.nimbusds.jose.jwk.source.JWKSource; import com.nimbusds.jose.proc.SecurityContext; import com.nimbusds.jose.util.Base64URL; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.jose.TestKeys; import org.springframework.security.oauth2.jose.jws.JwsAlgorithms; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java index d3d1f8323f..97c9f3a612 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java @@ -30,9 +30,9 @@ import okhttp3.mockwebserver.Dispatcher; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -92,14 +92,14 @@ public class JwtDecodersTests { private String issuer; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); this.issuer = createIssuerFromServer() + "path"; } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtIssuerValidatorTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtIssuerValidatorTests.java index 9c32ee302f..aa3192f067 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtIssuerValidatorTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtIssuerValidatorTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.jwt; import java.net.MalformedURLException; import java.net.URL; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTests.java index 7a55920883..ff110d0432 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTests.java @@ -23,7 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.jose.jws.JwsAlgorithms; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTimestampValidatorTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTimestampValidatorTests.java index 4f1708e85d..e2817ff507 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTimestampValidatorTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtTimestampValidatorTests.java @@ -25,7 +25,7 @@ import java.util.Collections; import java.util.Map; import java.util.stream.Collectors; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.OAuth2Error; import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/MappedJwtClaimSetConverterTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/MappedJwtClaimSetConverterTests.java index 403d5692ea..309559d5f5 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/MappedJwtClaimSetConverterTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/MappedJwtClaimSetConverterTests.java @@ -26,7 +26,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupportTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupportTests.java index 28f407ded2..dd0d8e4636 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupportTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupportTests.java @@ -23,7 +23,7 @@ import java.util.Map; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.http.HttpStatus; diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderTests.java index 5500f2a3bc..4ac91d46f6 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderTests.java @@ -54,8 +54,8 @@ import com.nimbusds.jwt.proc.BadJWTException; import com.nimbusds.jwt.proc.DefaultJWTProcessor; import com.nimbusds.jwt.proc.JWTProcessor; import okhttp3.mockwebserver.MockWebServer; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.cache.Cache; @@ -121,7 +121,7 @@ public class NimbusJwtDecoderTests { NimbusJwtDecoder jwtDecoder = new NimbusJwtDecoder(withoutSigning()); - @BeforeClass + @BeforeAll public static void keyFactory() throws NoSuchAlgorithmException { kf = KeyFactory.getInstance("RSA"); } diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java index 1e65c7728c..89fb7e3113 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java @@ -47,10 +47,10 @@ import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.SignedJWT; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -114,12 +114,12 @@ public class NimbusReactiveJwtDecoderTests { private static KeyFactory kf; - @BeforeClass + @BeforeAll public static void keyFactory() throws NoSuchAlgorithmException { kf = KeyFactory.getInstance("RSA"); } - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -127,7 +127,7 @@ public class NimbusReactiveJwtDecoderTests { this.decoder = new NimbusReactiveJwtDecoder(this.server.url("/certs").toString()); } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/ReactiveJwtDecodersTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/ReactiveJwtDecodersTests.java index 9503faba02..cc2d57bbcf 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/ReactiveJwtDecodersTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/ReactiveJwtDecodersTests.java @@ -30,9 +30,9 @@ import okhttp3.mockwebserver.Dispatcher; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -91,7 +91,7 @@ public class ReactiveJwtDecodersTests { private String issuer; - @Before + @BeforeEach public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); @@ -99,7 +99,7 @@ public class ReactiveJwtDecodersTests { this.issuer += "path"; } - @After + @AfterEach public void cleanup() throws Exception { this.server.shutdown(); } diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/ReactiveRemoteJWKSourceTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/ReactiveRemoteJWKSourceTests.java index 7fecc4fc5e..ddcc1c913f 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/ReactiveRemoteJWKSourceTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/ReactiveRemoteJWKSourceTests.java @@ -26,11 +26,11 @@ import com.nimbusds.jose.jwk.KeyType; import com.nimbusds.jose.jwk.KeyUse; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -40,7 +40,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ReactiveRemoteJWKSourceTests { @Mock @@ -90,7 +90,7 @@ public class ReactiveRemoteJWKSourceTests { + "}\n"; // @formatter:on - @Before + @BeforeEach public void setup() { this.server = new MockWebServer(); this.source = new ReactiveRemoteJWKSource(this.server.url("/").toString()); diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenAuthenticationTokenTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenAuthenticationTokenTests.java index 9669a52d77..abb48dff3c 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenAuthenticationTokenTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenAuthenticationTokenTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.server.resource; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenErrorTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenErrorTests.java index 63111e86ab..2b55408d49 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenErrorTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenErrorTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.server.resource; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenErrorsTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenErrorsTests.java index e8baca0464..1c2752c81b 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenErrorsTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/BearerTokenErrorsTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.server.resource; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/DefaultAuthenticationEventPublisherBearerTokenTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/DefaultAuthenticationEventPublisherBearerTokenTests.java index 10fdb5fe57..89d79da1ed 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/DefaultAuthenticationEventPublisherBearerTokenTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/DefaultAuthenticationEventPublisherBearerTokenTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.server.resource; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; import org.springframework.security.authentication.DefaultAuthenticationEventPublisher; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/BearerTokenAuthenticationTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/BearerTokenAuthenticationTests.java index 1f4cfdf292..de6193ec20 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/BearerTokenAuthenticationTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/BearerTokenAuthenticationTests.java @@ -25,8 +25,8 @@ import java.util.List; import java.util.Map; import net.minidev.json.JSONObject; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; @@ -56,7 +56,7 @@ public class BearerTokenAuthenticationTests { private final Collection authorities = AuthorityUtils.createAuthorityList("USER"); - @Before + @BeforeEach public void setUp() { this.attributesMap.put(OAuth2IntrospectionClaimNames.SUBJECT, this.name); this.attributesMap.put(OAuth2IntrospectionClaimNames.CLIENT_ID, "client_id"); diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/DelegatingJwtGrantedAuthoritiesConverterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/DelegatingJwtGrantedAuthoritiesConverterTests.java index 9bda7545ca..32db277d53 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/DelegatingJwtGrantedAuthoritiesConverterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/DelegatingJwtGrantedAuthoritiesConverterTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.server.resource.authentication; import java.util.Collection; import java.util.LinkedHashSet; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.security.core.GrantedAuthority; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverterTests.java index 9a8f373ec4..bdfa7f24fb 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverterTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.server.resource.authentication; import java.util.Arrays; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.security.authentication.AbstractAuthenticationToken; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationProviderTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationProviderTests.java index 9e92ce52e4..d89880f6c0 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationProviderTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationProviderTests.java @@ -18,11 +18,11 @@ package org.springframework.security.oauth2.server.resource.authentication; import java.util.function.Predicate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.convert.converter.Converter; import org.springframework.security.core.AuthenticationException; @@ -45,7 +45,7 @@ import static org.mockito.Mockito.mock; * * @author Josh Cummings */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class JwtAuthenticationProviderTests { @Mock @@ -56,7 +56,7 @@ public class JwtAuthenticationProviderTests { JwtAuthenticationProvider provider; - @Before + @BeforeEach public void setup() { this.provider = new JwtAuthenticationProvider(this.jwtDecoder); this.provider.setJwtAuthenticationConverter(this.jwtAuthenticationConverter); diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationTokenTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationTokenTests.java index dcd487b2d3..6f9ddf63b6 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationTokenTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationTokenTests.java @@ -18,9 +18,9 @@ package org.springframework.security.oauth2.server.resource.authentication; import java.util.Collection; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException * * @author Josh Cummings */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class JwtAuthenticationTokenTests { @Test diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtBearerTokenAuthenticationConverterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtBearerTokenAuthenticationConverterTests.java index 10d4744258..384ce4ea28 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtBearerTokenAuthenticationConverterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtBearerTokenAuthenticationConverterTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.server.resource.authentication; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.authority.SimpleGrantedAuthority; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtGrantedAuthoritiesConverterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtGrantedAuthoritiesConverterTests.java index d34c2e29e5..ff3cc30b8a 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtGrantedAuthoritiesConverterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtGrantedAuthoritiesConverterTests.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerAuthenticationManagerResolverTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerAuthenticationManagerResolverTests.java index f99fcb1248..99ab3933b9 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerAuthenticationManagerResolverTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerAuthenticationManagerResolverTests.java @@ -31,7 +31,7 @@ import com.nimbusds.jwt.PlainJWT; import net.minidev.json.JSONObject; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationManagerResolver; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerReactiveAuthenticationManagerResolverTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerReactiveAuthenticationManagerResolverTests.java index 81ee467720..c13eac86f8 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerReactiveAuthenticationManagerResolverTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerReactiveAuthenticationManagerResolverTests.java @@ -31,7 +31,7 @@ import com.nimbusds.jwt.PlainJWT; import net.minidev.json.JSONObject; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.security.authentication.ReactiveAuthenticationManager; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManagerTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManagerTests.java index 989044a046..add397c03d 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManagerTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManagerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.oauth2.server.resource.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -45,7 +45,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class JwtReactiveAuthenticationManagerTests { @Mock @@ -55,7 +55,7 @@ public class JwtReactiveAuthenticationManagerTests { private Jwt jwt; - @Before + @BeforeEach public void setup() { this.manager = new JwtReactiveAuthenticationManager(this.jwtDecoder); // @formatter:off diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProviderTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProviderTests.java index 9bf34998dd..f5b03b635f 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProviderTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenAuthenticationProviderTests.java @@ -22,7 +22,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.core.Authentication; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManagerTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManagerTests.java index 2dafb8f241..d01e0b08da 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManagerTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManagerTests.java @@ -22,7 +22,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.security.authentication.AuthenticationServiceException; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterAdapterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterAdapterTests.java index 292a49812f..15a7b6d861 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterAdapterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterAdapterTests.java @@ -19,7 +19,7 @@ package org.springframework.security.oauth2.server.resource.authentication; import java.util.Arrays; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.security.authentication.AbstractAuthenticationToken; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterTests.java index 7022bb254c..c4e532fe5a 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterTests.java @@ -18,7 +18,7 @@ package org.springframework.security.oauth2.server.resource.authentication; import java.util.Collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import org.springframework.core.convert.converter.Converter; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtGrantedAuthoritiesConverterAdapterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtGrantedAuthoritiesConverterAdapterTests.java index 9c099c050b..a8148bd220 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtGrantedAuthoritiesConverterAdapterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtGrantedAuthoritiesConverterAdapterTests.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.stream.Collectors; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.security.core.GrantedAuthority; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospectorTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospectorTests.java index 49ca325058..eecb4dab8b 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospectorTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospectorTests.java @@ -31,7 +31,7 @@ import okhttp3.mockwebserver.Dispatcher; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.convert.converter.Converter; import org.springframework.http.HttpHeaders; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospectorTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospectorTests.java index 844faa6d74..b1306d10e9 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospectorTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospectorTests.java @@ -30,7 +30,7 @@ import okhttp3.mockwebserver.Dispatcher; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.http.HttpHeaders; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/OAuth2IntrospectionAuthenticatedPrincipalTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/OAuth2IntrospectionAuthenticatedPrincipalTests.java index bb96cb17ec..1f13f37f43 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/OAuth2IntrospectionAuthenticatedPrincipalTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/OAuth2IntrospectionAuthenticatedPrincipalTests.java @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/BearerTokenAuthenticationEntryPointTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/BearerTokenAuthenticationEntryPointTests.java index 93e112e268..66f07bc23f 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/BearerTokenAuthenticationEntryPointTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/BearerTokenAuthenticationEntryPointTests.java @@ -16,8 +16,8 @@ package org.springframework.security.oauth2.server.resource.web; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletRequest; @@ -39,7 +39,7 @@ public class BearerTokenAuthenticationEntryPointTests { private BearerTokenAuthenticationEntryPoint authenticationEntryPoint; - @Before + @BeforeEach public void setUp() { this.authenticationEntryPoint = new BearerTokenAuthenticationEntryPoint(); } diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/BearerTokenAuthenticationFilterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/BearerTokenAuthenticationFilterTests.java index 738b13efba..418ca85c0a 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/BearerTokenAuthenticationFilterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/BearerTokenAuthenticationFilterTests.java @@ -21,12 +21,12 @@ import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockFilterChain; @@ -56,7 +56,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; * * @author Josh Cummings */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class BearerTokenAuthenticationFilterTests { @Mock @@ -83,7 +83,7 @@ public class BearerTokenAuthenticationFilterTests { MockFilterChain filterChain; - @Before + @BeforeEach public void httpMocks() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/DefaultBearerTokenResolverTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/DefaultBearerTokenResolverTests.java index e80ec201af..b67c6c3211 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/DefaultBearerTokenResolverTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/DefaultBearerTokenResolverTests.java @@ -18,8 +18,8 @@ package org.springframework.security.oauth2.server.resource.web; import java.util.Base64; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.oauth2.core.OAuth2AuthenticationException; @@ -40,7 +40,7 @@ public class DefaultBearerTokenResolverTests { private DefaultBearerTokenResolver resolver; - @Before + @BeforeEach public void setUp() { this.resolver = new DefaultBearerTokenResolver(); } diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/HeaderBearerTokenResolverTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/HeaderBearerTokenResolverTests.java index 075af21b7b..34c1b69ea4 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/HeaderBearerTokenResolverTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/HeaderBearerTokenResolverTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.server.resource.web; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/access/BearerTokenAccessDeniedHandlerTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/access/BearerTokenAccessDeniedHandlerTests.java index fd481e8f96..6a972a0046 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/access/BearerTokenAccessDeniedHandlerTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/access/BearerTokenAccessDeniedHandlerTests.java @@ -19,8 +19,8 @@ package org.springframework.security.oauth2.server.resource.web.access; import java.util.Collections; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -40,7 +40,7 @@ public class BearerTokenAccessDeniedHandlerTests { private BearerTokenAccessDeniedHandler accessDeniedHandler; - @Before + @BeforeEach public void setUp() { this.accessDeniedHandler = new BearerTokenAccessDeniedHandler(); } diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/access/server/BearerTokenServerAccessDeniedHandlerTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/access/server/BearerTokenServerAccessDeniedHandlerTests.java index 20f9a47d5f..8c71163e30 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/access/server/BearerTokenServerAccessDeniedHandlerTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/access/server/BearerTokenServerAccessDeniedHandlerTests.java @@ -20,8 +20,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.http.HttpStatus; @@ -40,7 +40,7 @@ public class BearerTokenServerAccessDeniedHandlerTests { private BearerTokenServerAccessDeniedHandler accessDeniedHandler; - @Before + @BeforeEach public void setUp() { this.accessDeniedHandler = new BearerTokenServerAccessDeniedHandler(); } diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/reactive/function/client/ServerBearerExchangeFilterFunctionTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/reactive/function/client/ServerBearerExchangeFilterFunctionTests.java index bafa9ed4c8..d389ecd637 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/reactive/function/client/ServerBearerExchangeFilterFunctionTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/reactive/function/client/ServerBearerExchangeFilterFunctionTests.java @@ -22,7 +22,7 @@ import java.time.Instant; import java.util.Collections; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/reactive/function/client/ServletBearerExchangeFilterFunctionTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/reactive/function/client/ServletBearerExchangeFilterFunctionTests.java index 54b4f164d8..037a76d096 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/reactive/function/client/ServletBearerExchangeFilterFunctionTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/reactive/function/client/ServletBearerExchangeFilterFunctionTests.java @@ -23,9 +23,9 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.util.context.Context; import org.springframework.http.HttpHeaders; @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Josh Cummings */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServletBearerExchangeFilterFunctionTests { private ServletBearerExchangeFilterFunction function = new ServletBearerExchangeFilterFunction(); diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/server/BearerTokenServerAuthenticationEntryPointTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/server/BearerTokenServerAuthenticationEntryPointTests.java index b3d76dca21..9bff9e7f7b 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/server/BearerTokenServerAuthenticationEntryPointTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/server/BearerTokenServerAuthenticationEntryPointTests.java @@ -16,7 +16,7 @@ package org.springframework.security.oauth2.server.resource.web.server; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverterTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverterTests.java index 9a8cf9c1b3..9a6cb9e2a1 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverterTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverterTests.java @@ -18,8 +18,8 @@ package org.springframework.security.oauth2.server.resource.web.server; import java.util.Base64; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -45,7 +45,7 @@ public class ServerBearerTokenAuthenticationConverterTests { private ServerBearerTokenAuthenticationConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new ServerBearerTokenAuthenticationConverter(); } diff --git a/openid/src/test/java/org/springframework/security/openid/OpenID4JavaConsumerTests.java b/openid/src/test/java/org/springframework/security/openid/OpenID4JavaConsumerTests.java index fcda3df4f1..632316954f 100644 --- a/openid/src/test/java/org/springframework/security/openid/OpenID4JavaConsumerTests.java +++ b/openid/src/test/java/org/springframework/security/openid/OpenID4JavaConsumerTests.java @@ -19,7 +19,7 @@ package org.springframework.security.openid; import java.util.Arrays; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; import org.openid4java.association.AssociationException; import org.openid4java.consumer.ConsumerException; diff --git a/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationFilterTests.java b/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationFilterTests.java index 546bb81a4e..678d38bc0a 100644 --- a/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationFilterTests.java +++ b/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationFilterTests.java @@ -23,8 +23,8 @@ import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -57,7 +57,7 @@ public class OpenIDAuthenticationFilterTests { private static final String DEFAULT_TARGET_URL = FILTER_PROCESS_URL; - @Before + @BeforeEach public void setUp() { this.filter = new OpenIDAuthenticationFilter(); this.filter.setConsumer(new MockOpenIDConsumer(REDIRECT_URL)); diff --git a/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationProviderTests.java b/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationProviderTests.java index af5adadd13..2bc034861d 100644 --- a/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationProviderTests.java +++ b/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationProviderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.openid; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.authentication.BadCredentialsException; diff --git a/remoting/src/test/java/org/springframework/security/remoting/dns/JndiDnsResolverTests.java b/remoting/src/test/java/org/springframework/security/remoting/dns/JndiDnsResolverTests.java index 7a8faf220d..3056c87f77 100644 --- a/remoting/src/test/java/org/springframework/security/remoting/dns/JndiDnsResolverTests.java +++ b/remoting/src/test/java/org/springframework/security/remoting/dns/JndiDnsResolverTests.java @@ -23,8 +23,8 @@ import javax.naming.directory.BasicAttribute; import javax.naming.directory.BasicAttributes; import javax.naming.directory.DirContext; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -44,7 +44,7 @@ public class JndiDnsResolverTests { private DirContext context; - @Before + @BeforeEach public void setup() { this.contextFactory = mock(InitialContextFactory.class); this.context = mock(DirContext.class); diff --git a/remoting/src/test/java/org/springframework/security/remoting/httpinvoker/AuthenticationSimpleHttpInvokerRequestExecutorTests.java b/remoting/src/test/java/org/springframework/security/remoting/httpinvoker/AuthenticationSimpleHttpInvokerRequestExecutorTests.java index 4bc006bcd9..859ded8472 100644 --- a/remoting/src/test/java/org/springframework/security/remoting/httpinvoker/AuthenticationSimpleHttpInvokerRequestExecutorTests.java +++ b/remoting/src/test/java/org/springframework/security/remoting/httpinvoker/AuthenticationSimpleHttpInvokerRequestExecutorTests.java @@ -21,8 +21,8 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ public class AuthenticationSimpleHttpInvokerRequestExecutorTests { - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/remoting/src/test/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocationTests.java b/remoting/src/test/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocationTests.java index 4810a2ba98..ed37bc00a9 100644 --- a/remoting/src/test/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocationTests.java +++ b/remoting/src/test/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocationTests.java @@ -19,8 +19,8 @@ package org.springframework.security.remoting.rmi; import java.lang.reflect.Method; import org.aopalliance.intercept.MethodInvocation; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.security.TargetObject; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException */ public class ContextPropagatingRemoteInvocationTests { - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AnonymousPayloadInterceptorTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AnonymousPayloadInterceptorTests.java index 67465ccc21..7c652f0249 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AnonymousPayloadInterceptorTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AnonymousPayloadInterceptorTests.java @@ -18,11 +18,11 @@ package org.springframework.security.rsocket.authentication; import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AnonymousPayloadInterceptorTests { @Mock @@ -46,7 +46,7 @@ public class AnonymousPayloadInterceptorTests { private AnonymousPayloadInterceptor interceptor; - @Before + @BeforeEach public void setup() { this.interceptor = new AnonymousPayloadInterceptor("key"); } diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadInterceptorTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadInterceptorTests.java index 474d6afe49..c622ef7cc8 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadInterceptorTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadInterceptorTests.java @@ -24,12 +24,12 @@ import io.rsocket.Payload; import io.rsocket.metadata.CompositeMetadataCodec; import io.rsocket.metadata.WellKnownMimeType; import io.rsocket.util.DefaultPayload; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import reactor.test.publisher.PublisherProbe; @@ -62,7 +62,7 @@ import static org.mockito.Mockito.verify; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthenticationPayloadInterceptorTests { static final MimeType COMPOSITE_METADATA = MimeTypeUtils diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/authorization/AuthorizationPayloadInterceptorTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/authorization/AuthorizationPayloadInterceptorTests.java index a4bbd99bd9..f5d6a7f07b 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/authorization/AuthorizationPayloadInterceptorTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/authorization/AuthorizationPayloadInterceptorTests.java @@ -16,10 +16,10 @@ package org.springframework.security.rsocket.authorization; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import reactor.test.publisher.PublisherProbe; @@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthorizationPayloadInterceptorTests { @Mock diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/authorization/PayloadExchangeMatcherReactiveAuthorizationManagerTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/authorization/PayloadExchangeMatcherReactiveAuthorizationManagerTests.java index 395c528108..0b697180a3 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/authorization/PayloadExchangeMatcherReactiveAuthorizationManagerTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/authorization/PayloadExchangeMatcherReactiveAuthorizationManagerTests.java @@ -16,10 +16,10 @@ package org.springframework.security.rsocket.authorization; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.security.authorization.AuthorizationDecision; @@ -37,7 +37,7 @@ import static org.mockito.BDDMockito.given; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class PayloadExchangeMatcherReactiveAuthorizationManagerTests { @Mock 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 f92c3c8f6c..17185e4a82 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 @@ -28,12 +28,12 @@ import io.rsocket.metadata.WellKnownMimeType; import io.rsocket.util.ByteBufPayload; import io.rsocket.util.DefaultPayload; import io.rsocket.util.RSocketProxy; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; import org.reactivestreams.Publisher; import org.reactivestreams.Subscription; @@ -71,7 +71,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class PayloadInterceptorRSocketTests { static final MimeType COMPOSITE_METADATA = MimeTypeUtils diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadSocketAcceptorInterceptorTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadSocketAcceptorInterceptorTests.java index 1727033cee..6a8cd0af7b 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadSocketAcceptorInterceptorTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadSocketAcceptorInterceptorTests.java @@ -24,12 +24,12 @@ import io.rsocket.Payload; import io.rsocket.RSocket; import io.rsocket.SocketAcceptor; import io.rsocket.metadata.WellKnownMimeType; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.http.MediaType; @@ -45,7 +45,7 @@ import static org.mockito.Mockito.verify; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class PayloadSocketAcceptorInterceptorTests { @Mock @@ -67,7 +67,7 @@ public class PayloadSocketAcceptorInterceptorTests { private PayloadSocketAcceptorInterceptor acceptorInterceptor; - @Before + @BeforeEach public void setup() { this.interceptors = Arrays.asList(this.interceptor); this.acceptorInterceptor = new PayloadSocketAcceptorInterceptor(this.interceptors); diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadSocketAcceptorTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadSocketAcceptorTests.java index 4c3722a1e9..e7c946873e 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadSocketAcceptorTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/core/PayloadSocketAcceptorTests.java @@ -25,12 +25,12 @@ import io.rsocket.Payload; import io.rsocket.RSocket; import io.rsocket.SocketAcceptor; import io.rsocket.metadata.WellKnownMimeType; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.util.context.Context; @@ -52,7 +52,7 @@ import static org.mockito.Mockito.verify; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class PayloadSocketAcceptorTests { private PayloadSocketAcceptor acceptor; @@ -74,7 +74,7 @@ public class PayloadSocketAcceptorTests { @Mock private Payload payload; - @Before + @BeforeEach public void setup() { this.interceptors = Arrays.asList(this.interceptor); this.acceptor = new PayloadSocketAcceptor(this.delegate, this.interceptors); diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/metadata/BasicAuthenticationDecoderTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/metadata/BasicAuthenticationDecoderTests.java index df8aa2c1be..aea03d174e 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/metadata/BasicAuthenticationDecoderTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/metadata/BasicAuthenticationDecoderTests.java @@ -18,7 +18,7 @@ package org.springframework.security.rsocket.metadata; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.core.ResolvableType; diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/util/matcher/RoutePayloadExchangeMatcherTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/util/matcher/RoutePayloadExchangeMatcherTests.java index 747e6e2c8a..8476be2c41 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/util/matcher/RoutePayloadExchangeMatcherTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/util/matcher/RoutePayloadExchangeMatcherTests.java @@ -21,11 +21,11 @@ import java.util.Map; import io.rsocket.Payload; import io.rsocket.metadata.WellKnownMimeType; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.MediaType; import org.springframework.messaging.rsocket.MetadataExtractor; @@ -43,7 +43,7 @@ import static org.mockito.BDDMockito.given; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class RoutePayloadExchangeMatcherTests { static final MimeType COMPOSITE_METADATA = MimeTypeUtils @@ -67,7 +67,7 @@ public class RoutePayloadExchangeMatcherTests { private RoutePayloadExchangeMatcher matcher; - @Before + @BeforeEach public void setup() { this.pattern = "a.b"; this.matcher = new RoutePayloadExchangeMatcher(this.metadataExtractor, this.routeMatcher, this.pattern); diff --git a/saml2/saml2-service-provider/src/opensaml3Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProviderTests.java b/saml2/saml2-service-provider/src/opensaml3Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProviderTests.java index 713c09f61c..95f0cfe580 100644 --- a/saml2/saml2-service-provider/src/opensaml3Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProviderTests.java +++ b/saml2/saml2-service-provider/src/opensaml3Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProviderTests.java @@ -33,7 +33,7 @@ import javax.xml.namespace.QName; import net.shibboleth.utilities.java.support.xml.SerializeSupport; import org.joda.time.DateTime; import org.joda.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opensaml.core.xml.XMLObject; import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport; import org.opensaml.core.xml.io.Marshaller; diff --git a/saml2/saml2-service-provider/src/opensaml3Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactoryTests.java b/saml2/saml2-service-provider/src/opensaml3Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactoryTests.java index 4b222b01d1..6cf056b7db 100644 --- a/saml2/saml2-service-provider/src/opensaml3Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactoryTests.java +++ b/saml2/saml2-service-provider/src/opensaml3Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactoryTests.java @@ -20,9 +20,9 @@ import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import org.joda.time.DateTime; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport; import org.opensaml.saml.common.xml.SAMLConstants; import org.opensaml.saml.saml2.core.AuthnRequest; @@ -63,7 +63,7 @@ public class OpenSamlAuthenticationRequestFactoryTests { private AuthnRequestUnmarshaller unmarshaller; - @Before + @BeforeEach public void setUp() { this.relyingPartyRegistrationBuilder = RelyingPartyRegistration.withRegistrationId("id") .assertionConsumerServiceLocation("template") @@ -181,14 +181,14 @@ public class OpenSamlAuthenticationRequestFactoryTests { @Test public void createAuthenticationRequestWhenDefaultThenReturnsPostBinding() { AuthnRequest authn = getAuthNRequest(Saml2MessageBinding.POST); - Assert.assertEquals(SAMLConstants.SAML2_POST_BINDING_URI, authn.getProtocolBinding()); + Assertions.assertEquals(SAMLConstants.SAML2_POST_BINDING_URI, authn.getProtocolBinding()); } @Test public void createAuthenticationRequestWhenSetUriThenReturnsCorrectBinding() { this.factory.setProtocolBinding(SAMLConstants.SAML2_REDIRECT_BINDING_URI); AuthnRequest authn = getAuthNRequest(Saml2MessageBinding.POST); - Assert.assertEquals(SAMLConstants.SAML2_REDIRECT_BINDING_URI, authn.getProtocolBinding()); + Assertions.assertEquals(SAMLConstants.SAML2_REDIRECT_BINDING_URI, authn.getProtocolBinding()); } @Test diff --git a/saml2/saml2-service-provider/src/opensaml4Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSaml4AuthenticationProviderTests.java b/saml2/saml2-service-provider/src/opensaml4Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSaml4AuthenticationProviderTests.java index 456c6d02ee..46724540fd 100644 --- a/saml2/saml2-service-provider/src/opensaml4Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSaml4AuthenticationProviderTests.java +++ b/saml2/saml2-service-provider/src/opensaml4Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSaml4AuthenticationProviderTests.java @@ -32,7 +32,7 @@ import java.util.function.Consumer; import javax.xml.namespace.QName; import net.shibboleth.utilities.java.support.xml.SerializeSupport; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opensaml.core.xml.XMLObject; import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport; import org.opensaml.core.xml.io.Marshaller; diff --git a/saml2/saml2-service-provider/src/opensaml4Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSaml4AuthenticationRequestFactoryTests.java b/saml2/saml2-service-provider/src/opensaml4Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSaml4AuthenticationRequestFactoryTests.java index 0297d10f7f..84c415ebe5 100644 --- a/saml2/saml2-service-provider/src/opensaml4Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSaml4AuthenticationRequestFactoryTests.java +++ b/saml2/saml2-service-provider/src/opensaml4Test/java/org/springframework/security/saml2/provider/service/authentication/OpenSaml4AuthenticationRequestFactoryTests.java @@ -20,9 +20,9 @@ import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import java.time.Instant; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport; import org.opensaml.saml.common.xml.SAMLConstants; import org.opensaml.saml.saml2.core.AuthnRequest; @@ -63,7 +63,7 @@ public class OpenSaml4AuthenticationRequestFactoryTests { private AuthnRequestUnmarshaller unmarshaller; - @Before + @BeforeEach public void setUp() { this.relyingPartyRegistrationBuilder = RelyingPartyRegistration.withRegistrationId("id") .assertionConsumerServiceLocation("template") @@ -181,7 +181,7 @@ public class OpenSaml4AuthenticationRequestFactoryTests { @Test public void createAuthenticationRequestWhenDefaultThenReturnsPostBinding() { AuthnRequest authn = getAuthNRequest(Saml2MessageBinding.POST); - Assert.assertEquals(SAMLConstants.SAML2_POST_BINDING_URI, authn.getProtocolBinding()); + Assertions.assertEquals(SAMLConstants.SAML2_POST_BINDING_URI, authn.getProtocolBinding()); } @Test diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/OpenSamlInitializationServiceTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/OpenSamlInitializationServiceTests.java index 7e7cb5a0d1..657bc9516f 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/OpenSamlInitializationServiceTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/OpenSamlInitializationServiceTests.java @@ -16,7 +16,7 @@ package org.springframework.security.saml2.core; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opensaml.core.config.ConfigurationService; import org.opensaml.core.xml.config.XMLObjectProviderRegistry; diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2ResponseValidatorResultTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2ResponseValidatorResultTests.java index 8c15cd58c5..6d9466b6f3 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2ResponseValidatorResultTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2ResponseValidatorResultTests.java @@ -16,7 +16,7 @@ package org.springframework.security.saml2.core; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2X509CredentialTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2X509CredentialTests.java index 3ea40c5d80..a700dfa014 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2X509CredentialTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2X509CredentialTests.java @@ -22,8 +22,8 @@ import java.security.PrivateKey; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.converter.RsaKeyConverters; import org.springframework.security.saml2.core.Saml2X509Credential.Saml2X509CredentialType; @@ -37,7 +37,7 @@ public class Saml2X509CredentialTests { private X509Certificate certificate; - @Before + @BeforeEach public void setup() throws Exception { String keyData = "-----BEGIN PRIVATE KEY-----\n" + "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANG7v8QjQGU3MwQE\n" diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/credentials/Saml2X509CredentialTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/credentials/Saml2X509CredentialTests.java index 5c3ac1231c..fe1fd7f46b 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/credentials/Saml2X509CredentialTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/credentials/Saml2X509CredentialTests.java @@ -22,8 +22,8 @@ import java.security.PrivateKey; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.converter.RsaKeyConverters; import org.springframework.security.saml2.credentials.Saml2X509Credential.Saml2X509CredentialType; @@ -39,7 +39,7 @@ public class Saml2X509CredentialTests { private X509Certificate certificate; - @Before + @BeforeEach public void setup() throws Exception { String keyData = "-----BEGIN PRIVATE KEY-----\n" + "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANG7v8QjQGU3MwQE\n" diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/DefaultSaml2AuthenticatedPrincipalTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/DefaultSaml2AuthenticatedPrincipalTests.java index c91651ef24..fe848b5a7f 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/DefaultSaml2AuthenticatedPrincipalTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/DefaultSaml2AuthenticatedPrincipalTests.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; import org.joda.time.DateTime; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlSigningUtilsTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlSigningUtilsTests.java index 1c85e74955..c6f0568bcd 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlSigningUtilsTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlSigningUtilsTests.java @@ -16,8 +16,8 @@ package org.springframework.security.saml2.provider.service.authentication; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opensaml.saml.saml2.core.Response; import org.opensaml.xmlsec.signature.Signature; @@ -33,7 +33,7 @@ public class OpenSamlSigningUtilsTests { private RelyingPartyRegistration registration; - @Before + @BeforeEach public void setup() { this.registration = RelyingPartyRegistration.withRegistrationId("saml-idp") .entityId("https://some.idp.example.com/entity-id").signingX509Credentials((c) -> { diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/Saml2AuthenticationRequestFactoryTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/Saml2AuthenticationRequestFactoryTests.java index c5b611e6d6..2339e59a25 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/Saml2AuthenticationRequestFactoryTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/Saml2AuthenticationRequestFactoryTests.java @@ -18,7 +18,7 @@ package org.springframework.security.saml2.provider.service.authentication; import java.util.UUID; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.saml2.credentials.TestSaml2X509Credentials; import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration; diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolverTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolverTests.java index 2613e452b3..cef7516c4b 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolverTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolverTests.java @@ -16,7 +16,7 @@ package org.springframework.security.saml2.provider.service.metadata; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.saml2.core.TestSaml2X509Credentials; import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration; diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlAssertingPartyMetadataConverterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlAssertingPartyMetadataConverterTests.java index dc3066baee..1083fb1629 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlAssertingPartyMetadataConverterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlAssertingPartyMetadataConverterTests.java @@ -22,8 +22,8 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.Base64; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opensaml.xmlsec.signature.support.SignatureConstants; import org.springframework.security.saml2.Saml2Exception; @@ -58,7 +58,7 @@ public class OpenSamlAssertingPartyMetadataConverterTests { private OpenSamlAssertingPartyMetadataConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new OpenSamlAssertingPartyMetadataConverter(); } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests.java index 072f1cc472..c6b7c1e5f9 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests.java @@ -22,8 +22,8 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.Base64; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.http.client.MockClientHttpResponse; @@ -56,7 +56,7 @@ public class OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests { private OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter(); } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationTests.java index 4428e54fcf..d25d4b981c 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationTests.java @@ -16,7 +16,7 @@ package org.springframework.security.saml2.provider.service.registration; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.saml2.credentials.TestSaml2X509Credentials; import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter; diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationsTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationsTests.java index 9b74aa64a0..0aadfbb532 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationsTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationsTests.java @@ -25,8 +25,8 @@ import java.util.stream.Collectors; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.security.saml2.Saml2Exception; @@ -41,7 +41,7 @@ public class RelyingPartyRegistrationsTests { private String metadata; - @Before + @BeforeEach public void setup() throws Exception { ClassPathResource resource = new ClassPathResource("test-metadata.xml"); try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.getInputStream()))) { diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationFilterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationFilterTests.java index 1563951b15..9c5a660fe0 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationFilterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationFilterTests.java @@ -18,9 +18,9 @@ package org.springframework.security.saml2.provider.service.servlet.filter; import javax.servlet.http.HttpServletResponse; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -41,7 +41,7 @@ public class Saml2WebSsoAuthenticationFilterTests { private HttpServletResponse response = new MockHttpServletResponse(); - @Before + @BeforeEach public void setup() { this.filter = new Saml2WebSsoAuthenticationFilter(this.repository); this.request.setPathInfo("/login/saml2/sso/idp-registration-id"); @@ -62,7 +62,7 @@ public class Saml2WebSsoAuthenticationFilterTests { @Test public void requiresAuthenticationWhenHappyPathThenReturnsTrue() { - Assert.assertTrue(this.filter.requiresAuthentication(this.request, this.response)); + Assertions.assertTrue(this.filter.requiresAuthentication(this.request, this.response)); } @Test @@ -70,7 +70,7 @@ public class Saml2WebSsoAuthenticationFilterTests { this.filter = new Saml2WebSsoAuthenticationFilter(this.repository, "/some/other/path/{registrationId}"); this.request.setPathInfo("/some/other/path/idp-registration-id"); this.request.setParameter("SAMLResponse", "xml-data-goes-here"); - Assert.assertTrue(this.filter.requiresAuthentication(this.request, this.response)); + Assertions.assertTrue(this.filter.requiresAuthentication(this.request, this.response)); } @Test diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationRequestFilterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationRequestFilterTests.java index 3f0bf6cf84..d1832cf1d9 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationRequestFilterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationRequestFilterTests.java @@ -21,8 +21,8 @@ import java.nio.charset.StandardCharsets; import javax.servlet.ServletException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -68,7 +68,7 @@ public class Saml2WebSsoAuthenticationRequestFilterTests { private RelyingPartyRegistration.Builder rpBuilder; - @Before + @BeforeEach public void setup() { this.filter = new Saml2WebSsoAuthenticationRequestFilter(this.resolver, this.factory); this.request = new MockHttpServletRequest(); diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/DefaultRelyingPartyRegistrationResolverTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/DefaultRelyingPartyRegistrationResolverTests.java index 41418978c4..3b786cdef0 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/DefaultRelyingPartyRegistrationResolverTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/DefaultRelyingPartyRegistrationResolverTests.java @@ -16,7 +16,7 @@ package org.springframework.security.saml2.provider.service.web; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.saml2.provider.service.registration.InMemoryRelyingPartyRegistrationRepository; diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/DefaultSaml2AuthenticationRequestContextResolverTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/DefaultSaml2AuthenticationRequestContextResolverTests.java index 1905a0db3b..273fe0484e 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/DefaultSaml2AuthenticationRequestContextResolverTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/DefaultSaml2AuthenticationRequestContextResolverTests.java @@ -16,8 +16,8 @@ package org.springframework.security.saml2.provider.service.web; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.saml2.credentials.TestSaml2X509Credentials; @@ -52,7 +52,7 @@ public class DefaultSaml2AuthenticationRequestContextResolverTests { private Saml2AuthenticationRequestContextResolver authenticationRequestContextResolver = new DefaultSaml2AuthenticationRequestContextResolver( new DefaultRelyingPartyRegistrationResolver((id) -> this.relyingPartyBuilder.build())); - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.request.setPathInfo("/saml2/authenticate/registration-id"); diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverterTests.java index 4a5e9e2fea..628554a461 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverterTests.java @@ -21,10 +21,10 @@ import java.nio.charset.StandardCharsets; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.convert.converter.Converter; import org.springframework.core.io.ClassPathResource; @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class Saml2AuthenticationTokenConverterTests { @Mock diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java index f71bfcea89..ced8ad5a87 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java @@ -21,8 +21,8 @@ import java.nio.charset.StandardCharsets; import javax.servlet.FilterChain; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.web.MockHttpServletRequest; @@ -59,7 +59,7 @@ public class Saml2MetadataFilterTests { FilterChain chain; - @Before + @BeforeEach public void setup() { this.repository = mock(RelyingPartyRegistrationRepository.class); this.resolver = mock(Saml2MetadataResolver.class); diff --git a/taglibs/src/test/java/org/springframework/security/taglibs/TldTests.java b/taglibs/src/test/java/org/springframework/security/taglibs/TldTests.java index 37fad7c6c3..ca34aed4d2 100644 --- a/taglibs/src/test/java/org/springframework/security/taglibs/TldTests.java +++ b/taglibs/src/test/java/org/springframework/security/taglibs/TldTests.java @@ -21,7 +21,7 @@ import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.w3c.dom.Document; import static org.assertj.core.api.Assertions.assertThat; diff --git a/taglibs/src/test/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTagTests.java b/taglibs/src/test/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTagTests.java index d203c3b017..12addcc94e 100644 --- a/taglibs/src/test/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTagTests.java +++ b/taglibs/src/test/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTagTests.java @@ -23,9 +23,9 @@ import javax.servlet.ServletContext; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -59,7 +59,7 @@ public class AbstractAuthorizeTagTests { private MockServletContext servletContext; - @Before + @BeforeEach public void setup() { this.tag = new AuthzTag(); this.request = new MockHttpServletRequest(); @@ -67,7 +67,7 @@ public class AbstractAuthorizeTagTests { this.servletContext = new MockServletContext(); } - @After + @AfterEach public void teardown() { SecurityContextHolder.clearContext(); } diff --git a/taglibs/src/test/java/org/springframework/security/taglibs/authz/AccessControlListTagTests.java b/taglibs/src/test/java/org/springframework/security/taglibs/authz/AccessControlListTagTests.java index 84d562ddb9..2c319d5e5c 100644 --- a/taglibs/src/test/java/org/springframework/security/taglibs/authz/AccessControlListTagTests.java +++ b/taglibs/src/test/java/org/springframework/security/taglibs/authz/AccessControlListTagTests.java @@ -22,9 +22,9 @@ import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.jsp.tagext.Tag; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -58,7 +58,7 @@ public class AccessControlListTagTests { Authentication bob = new TestingAuthenticationToken("bob", "bobspass", "A"); - @Before + @BeforeEach @SuppressWarnings("rawtypes") public void setup() { SecurityContextHolder.getContext().setAuthentication(this.bob); @@ -74,7 +74,7 @@ public class AccessControlListTagTests { this.tag.setPageContext(this.pageContext); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthenticationTagTests.java b/taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthenticationTagTests.java index 84fcdda694..dd53eabfa1 100644 --- a/taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthenticationTagTests.java +++ b/taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthenticationTagTests.java @@ -19,8 +19,8 @@ package org.springframework.security.taglibs.authz; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.Tag; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; @@ -44,7 +44,7 @@ public class AuthenticationTagTests { new User("rodUserDetails", "koala", true, true, true, true, AuthorityUtils.NO_AUTHORITIES), "koala", AuthorityUtils.NO_AUTHORITIES); - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthorizeTagTests.java b/taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthorizeTagTests.java index 5111ff448b..aa64b505b5 100644 --- a/taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthorizeTagTests.java +++ b/taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthorizeTagTests.java @@ -19,12 +19,12 @@ package org.springframework.security.taglibs.authz; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.Tag; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.mock.web.MockHttpServletRequest; @@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given; * @author Francois Beausoleil * @author Luke Taylor */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthorizeTagTests { @Mock @@ -62,7 +62,7 @@ public class AuthorizeTagTests { private final TestingAuthenticationToken currentUser = new TestingAuthenticationToken("abc", "123", "ROLE SUPERVISOR", "ROLE_TELLER"); - @Before + @BeforeEach public void setUp() { SecurityContextHolder.getContext().setAuthentication(this.currentUser); StaticWebApplicationContext ctx = new StaticWebApplicationContext(); @@ -77,7 +77,7 @@ public class AuthorizeTagTests { this.authorizeTag.setPageContext(new MockPageContext(servletCtx, this.request, new MockHttpServletResponse())); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/taglibs/src/test/java/org/springframework/security/taglibs/csrf/AbstractCsrfTagTests.java b/taglibs/src/test/java/org/springframework/security/taglibs/csrf/AbstractCsrfTagTests.java index 51727e71dd..60522e600e 100644 --- a/taglibs/src/test/java/org/springframework/security/taglibs/csrf/AbstractCsrfTagTests.java +++ b/taglibs/src/test/java/org/springframework/security/taglibs/csrf/AbstractCsrfTagTests.java @@ -21,8 +21,8 @@ import java.io.UnsupportedEncodingException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.Tag; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -44,7 +44,7 @@ public class AbstractCsrfTagTests { private MockHttpServletResponse response; - @Before + @BeforeEach public void setUp() { MockServletContext servletContext = new MockServletContext(); this.request = new MockHttpServletRequest(servletContext); diff --git a/taglibs/src/test/java/org/springframework/security/taglibs/csrf/CsrfInputTagTests.java b/taglibs/src/test/java/org/springframework/security/taglibs/csrf/CsrfInputTagTests.java index aa9b84251a..ed2b90c3de 100644 --- a/taglibs/src/test/java/org/springframework/security/taglibs/csrf/CsrfInputTagTests.java +++ b/taglibs/src/test/java/org/springframework/security/taglibs/csrf/CsrfInputTagTests.java @@ -16,8 +16,8 @@ package org.springframework.security.taglibs.csrf; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.web.csrf.CsrfToken; import org.springframework.security.web.csrf.DefaultCsrfToken; @@ -31,7 +31,7 @@ public class CsrfInputTagTests { public CsrfInputTag tag; - @Before + @BeforeEach public void setUp() { this.tag = new CsrfInputTag(); } diff --git a/taglibs/src/test/java/org/springframework/security/taglibs/csrf/CsrfMetaTagsTagTests.java b/taglibs/src/test/java/org/springframework/security/taglibs/csrf/CsrfMetaTagsTagTests.java index 6e07a33e72..57983faa4f 100644 --- a/taglibs/src/test/java/org/springframework/security/taglibs/csrf/CsrfMetaTagsTagTests.java +++ b/taglibs/src/test/java/org/springframework/security/taglibs/csrf/CsrfMetaTagsTagTests.java @@ -16,8 +16,8 @@ package org.springframework.security.taglibs.csrf; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.web.csrf.CsrfToken; import org.springframework.security.web.csrf.DefaultCsrfToken; @@ -31,7 +31,7 @@ public class CsrfMetaTagsTagTests { public CsrfMetaTagsTag tag; - @Before + @BeforeEach public void setUp() { this.tag = new CsrfMetaTagsTag(); } diff --git a/test/src/test/java/org/springframework/security/test/context/TestSecurityContextHolderTests.java b/test/src/test/java/org/springframework/security/test/context/TestSecurityContextHolderTests.java index 28362616aa..655e4c7dab 100644 --- a/test/src/test/java/org/springframework/security/test/context/TestSecurityContextHolderTests.java +++ b/test/src/test/java/org/springframework/security/test/context/TestSecurityContextHolderTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.context; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; @@ -31,12 +31,12 @@ public class TestSecurityContextHolderTests { private SecurityContext context; - @Before + @BeforeEach public void setup() { this.context = SecurityContextHolder.createEmptyContext(); } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/context/annotation/SecurityTestExecutionListenerTests.java b/test/src/test/java/org/springframework/security/test/context/annotation/SecurityTestExecutionListenerTests.java index 5bd5b512b8..40a3aeb7bd 100644 --- a/test/src/test/java/org/springframework/security/test/context/annotation/SecurityTestExecutionListenerTests.java +++ b/test/src/test/java/org/springframework/security/test/context/annotation/SecurityTestExecutionListenerTests.java @@ -18,8 +18,8 @@ package org.springframework.security.test.context.annotation; import java.security.Principal; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -27,11 +27,11 @@ import org.springframework.security.core.context.ReactiveSecurityContextHolder; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class SecurityTestExecutionListenerTests { diff --git a/test/src/test/java/org/springframework/security/test/context/showcase/WithMockUserParentTests.java b/test/src/test/java/org/springframework/security/test/context/showcase/WithMockUserParentTests.java index d7294d510f..53c8304c05 100644 --- a/test/src/test/java/org/springframework/security/test/context/showcase/WithMockUserParentTests.java +++ b/test/src/test/java/org/springframework/security/test/context/showcase/WithMockUserParentTests.java @@ -16,8 +16,8 @@ package org.springframework.security.test.context.showcase; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; @@ -26,14 +26,14 @@ import org.springframework.security.config.annotation.method.configuration.Enabl import org.springframework.security.test.context.showcase.service.HelloMessageService; import org.springframework.security.test.context.showcase.service.MessageService; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; /** * @author Eddú Meléndez */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = WithMockUserParentTests.Config.class) public class WithMockUserParentTests extends WithMockUserParent { diff --git a/test/src/test/java/org/springframework/security/test/context/showcase/WithMockUserTests.java b/test/src/test/java/org/springframework/security/test/context/showcase/WithMockUserTests.java index 23f956e627..2889448217 100644 --- a/test/src/test/java/org/springframework/security/test/context/showcase/WithMockUserTests.java +++ b/test/src/test/java/org/springframework/security/test/context/showcase/WithMockUserTests.java @@ -16,8 +16,8 @@ package org.springframework.security.test.context.showcase; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; @@ -28,7 +28,7 @@ import org.springframework.security.test.context.showcase.service.HelloMessageSe import org.springframework.security.test.context.showcase.service.MessageService; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; /** * @author Rob Winch */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = WithMockUserTests.Config.class) public class WithMockUserTests { diff --git a/test/src/test/java/org/springframework/security/test/context/showcase/WithUserDetailsTests.java b/test/src/test/java/org/springframework/security/test/context/showcase/WithUserDetailsTests.java index 6188f54db1..114cbb298a 100644 --- a/test/src/test/java/org/springframework/security/test/context/showcase/WithUserDetailsTests.java +++ b/test/src/test/java/org/springframework/security/test/context/showcase/WithUserDetailsTests.java @@ -16,8 +16,8 @@ package org.springframework.security.test.context.showcase; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -33,7 +33,7 @@ import org.springframework.security.test.context.showcase.service.HelloMessageSe import org.springframework.security.test.context.showcase.service.MessageService; import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; /** * @author Rob Winch */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = WithUserDetailsTests.Config.class) public class WithUserDetailsTests { diff --git a/test/src/test/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListenerTests.java b/test/src/test/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListenerTests.java index b9e88381ad..b4ed86d545 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListenerTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListenerTests.java @@ -22,11 +22,11 @@ package org.springframework.security.test.context.support; */ import java.util.concurrent.ForkJoinPool; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Hooks; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -42,7 +42,7 @@ import org.springframework.test.context.TestContext; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ReactorContextTestExecutionListenerTests { @Mock @@ -50,7 +50,7 @@ public class ReactorContextTestExecutionListenerTests { private ReactorContextTestExecutionListener listener = new ReactorContextTestExecutionListener(); - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); Hooks.resetOnLastOperator(); diff --git a/test/src/test/java/org/springframework/security/test/context/support/WithAnonymousUserTests.java b/test/src/test/java/org/springframework/security/test/context/support/WithAnonymousUserTests.java index 94780c93db..1a61fa5d9d 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/WithAnonymousUserTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/WithAnonymousUserTests.java @@ -16,7 +16,7 @@ package org.springframework.security.test.context.support; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.annotation.AnnotatedElementUtils; diff --git a/test/src/test/java/org/springframework/security/test/context/support/WithMockUserSecurityContextFactoryTests.java b/test/src/test/java/org/springframework/security/test/context/support/WithMockUserSecurityContextFactoryTests.java index 9398fa33d7..f755d7b983 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/WithMockUserSecurityContextFactoryTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/WithMockUserSecurityContextFactoryTests.java @@ -16,18 +16,18 @@ package org.springframework.security.test.context.support; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class WithMockUserSecurityContextFactoryTests { @Mock @@ -35,7 +35,7 @@ public class WithMockUserSecurityContextFactoryTests { private WithMockUserSecurityContextFactory factory; - @Before + @BeforeEach public void setup() { this.factory = new WithMockUserSecurityContextFactory(); } diff --git a/test/src/test/java/org/springframework/security/test/context/support/WithMockUserTests.java b/test/src/test/java/org/springframework/security/test/context/support/WithMockUserTests.java index 763cfdf9b2..e269d910a9 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/WithMockUserTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/WithMockUserTests.java @@ -16,7 +16,7 @@ package org.springframework.security.test.context.support; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.annotation.AnnotatedElementUtils; diff --git a/test/src/test/java/org/springframework/security/test/context/support/WithSecurityContextTestExcecutionListenerTests.java b/test/src/test/java/org/springframework/security/test/context/support/WithSecurityContextTestExcecutionListenerTests.java index 7a96aec512..df09bf9b0d 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/WithSecurityContextTestExcecutionListenerTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/WithSecurityContextTestExcecutionListenerTests.java @@ -24,12 +24,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class WithSecurityContextTestExcecutionListenerTests { private ConfigurableApplicationContext context; @@ -60,13 +60,13 @@ public class WithSecurityContextTestExcecutionListenerTests { private WithSecurityContextTestExecutionListener listener; - @Before + @BeforeEach public void setup() { this.listener = new WithSecurityContextTestExecutionListener(); this.context = new AnnotationConfigApplicationContext(Config.class); } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); if (this.context != null) { diff --git a/test/src/test/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListenerTests.java b/test/src/test/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListenerTests.java index 64186a5b96..ba36cdba47 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListenerTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListenerTests.java @@ -19,15 +19,15 @@ package org.springframework.security.test.context.support; import java.lang.reflect.Method; import java.util.function.Supplier; -import org.junit.After; import org.junit.ClassRule; import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -52,7 +52,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) @ContextConfiguration(classes = WithSecurityContextTestExecutionListenerTests.NoOpConfiguration.class) public class WithSecurityContextTestExecutionListenerTests { @@ -70,7 +70,7 @@ public class WithSecurityContextTestExecutionListenerTests { private WithSecurityContextTestExecutionListener listener = new WithSecurityContextTestExecutionListener(); - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/context/support/WithUserDetailsSecurityContextFactoryTests.java b/test/src/test/java/org/springframework/security/test/context/support/WithUserDetailsSecurityContextFactoryTests.java index 716b05f694..b0747774d1 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/WithUserDetailsSecurityContextFactoryTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/WithUserDetailsSecurityContextFactoryTests.java @@ -16,11 +16,11 @@ package org.springframework.security.test.context.support; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.beans.factory.BeanFactory; @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class WithUserDetailsSecurityContextFactoryTests { @Mock @@ -57,7 +57,7 @@ public class WithUserDetailsSecurityContextFactoryTests { private WithUserDetailsSecurityContextFactory factory; - @Before + @BeforeEach public void setup() { this.factory = new WithUserDetailsSecurityContextFactory(this.beans); } diff --git a/test/src/test/java/org/springframework/security/test/context/support/WithUserDetailsTests.java b/test/src/test/java/org/springframework/security/test/context/support/WithUserDetailsTests.java index b2d041d980..2914b46356 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/WithUserDetailsTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/WithUserDetailsTests.java @@ -16,7 +16,7 @@ package org.springframework.security.test.context.support; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.core.annotation.AnnotationUtils; diff --git a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurerOpaqueTokenTests.java b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurerOpaqueTokenTests.java index 4ddd34771d..7c4096fd95 100644 --- a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurerOpaqueTokenTests.java +++ b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurerOpaqueTokenTests.java @@ -18,9 +18,9 @@ package org.springframework.security.test.web.reactive.server; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.http.HttpHeaders; @@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Josh Cummings * @since 5.3 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockServerConfigurerOpaqueTokenTests extends AbstractMockServerConfigurersTests { private GrantedAuthority authority1 = new SimpleGrantedAuthority("one"); diff --git a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersAnnotatedTests.java b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersAnnotatedTests.java index 97735c1ab9..7cf807c1f4 100644 --- a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersAnnotatedTests.java +++ b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersAnnotatedTests.java @@ -18,8 +18,8 @@ package org.springframework.security.test.web.reactive.server; import java.util.concurrent.ForkJoinPool; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -29,14 +29,14 @@ import org.springframework.security.test.context.TestSecurityContextHolder; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.reactive.server.WebTestClient; /** * @author Rob Winch * @since 5.0 */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class SecurityMockServerConfigurersAnnotatedTests extends AbstractMockServerConfigurersTests { diff --git a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersClassAnnotatedTests.java b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersClassAnnotatedTests.java index a96f00493a..2bfa8445da 100644 --- a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersClassAnnotatedTests.java +++ b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersClassAnnotatedTests.java @@ -18,8 +18,8 @@ package org.springframework.security.test.web.reactive.server; import java.security.Principal; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -28,7 +28,7 @@ import org.springframework.security.test.context.TestSecurityContextHolder; import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.reactive.server.WebTestClient; import static org.assertj.core.api.Assertions.assertThat; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @since 5.0 */ @WithMockUser -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SecurityTestExecutionListeners public class SecurityMockServerConfigurersClassAnnotatedTests extends AbstractMockServerConfigurersTests { diff --git a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersJwtTests.java b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersJwtTests.java index 7a0aa28c8b..941c4ea364 100644 --- a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersJwtTests.java +++ b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersJwtTests.java @@ -19,10 +19,10 @@ package org.springframework.security.test.web.reactive.server; import java.util.Arrays; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.http.HttpHeaders; @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Josh Cummings * @since 5.2 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockServerConfigurersJwtTests extends AbstractMockServerConfigurersTests { @Mock diff --git a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOAuth2ClientTests.java b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOAuth2ClientTests.java index 8990a7101e..c7910c7ebf 100644 --- a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOAuth2ClientTests.java +++ b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOAuth2ClientTests.java @@ -16,11 +16,11 @@ package org.springframework.security.test.web.reactive.server; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.http.HttpHeaders; @@ -50,7 +50,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockServerConfigurersOAuth2ClientTests extends AbstractMockServerConfigurersTests { private OAuth2LoginController controller = new OAuth2LoginController(); @@ -63,7 +63,7 @@ public class SecurityMockServerConfigurersOAuth2ClientTests extends AbstractMock private WebTestClient client; - @Before + @BeforeEach public void setup() { this.client = WebTestClient.bindToController(this.controller) .argumentResolvers((c) -> c.addCustomResolver(new OAuth2AuthorizedClientArgumentResolver( diff --git a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOAuth2LoginTests.java b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOAuth2LoginTests.java index 0820d65d50..6c79db66a2 100644 --- a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOAuth2LoginTests.java +++ b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOAuth2LoginTests.java @@ -19,11 +19,11 @@ package org.springframework.security.test.web.reactive.server; import java.util.Collection; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -45,7 +45,7 @@ import org.springframework.web.bind.annotation.RestController; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockServerConfigurersOAuth2LoginTests extends AbstractMockServerConfigurersTests { private OAuth2LoginController controller = new OAuth2LoginController(); @@ -58,7 +58,7 @@ public class SecurityMockServerConfigurersOAuth2LoginTests extends AbstractMockS private WebTestClient client; - @Before + @BeforeEach public void setup() { this.client = WebTestClient.bindToController(this.controller) .argumentResolvers((c) -> c.addCustomResolver(new OAuth2AuthorizedClientArgumentResolver( diff --git a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOidcLoginTests.java b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOidcLoginTests.java index b9361bfbdd..55f5840ad0 100644 --- a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOidcLoginTests.java +++ b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersOidcLoginTests.java @@ -18,11 +18,11 @@ package org.springframework.security.test.web.reactive.server; import java.util.Collection; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -46,7 +46,7 @@ import org.springframework.web.bind.annotation.RestController; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockServerConfigurersOidcLoginTests extends AbstractMockServerConfigurersTests { private OAuth2LoginController controller = new OAuth2LoginController(); @@ -59,7 +59,7 @@ public class SecurityMockServerConfigurersOidcLoginTests extends AbstractMockSer private WebTestClient client; - @Before + @BeforeEach public void setup() { this.client = WebTestClient.bindToController(this.controller) .argumentResolvers((c) -> c.addCustomResolver(new OAuth2AuthorizedClientArgumentResolver( diff --git a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersTests.java b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersTests.java index 3b11ff0c73..abcd55732a 100644 --- a/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersTests.java +++ b/test/src/test/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurersTests.java @@ -18,7 +18,7 @@ package org.springframework.security.test.web.reactive.server; import java.security.Principal; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/Sec2935Tests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/Sec2935Tests.java index ebca73b566..a8ea29a6f6 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/Sec2935Tests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/Sec2935Tests.java @@ -16,10 +16,10 @@ package org.springframework.security.test.web.servlet.request; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -29,7 +29,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -45,7 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * @author Rob Winch */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class Sec2935Tests { @@ -55,7 +55,7 @@ public class Sec2935Tests { MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } @@ -96,7 +96,7 @@ public class Sec2935Tests { .andExpect(authenticated().withUsername("default")); } - @Ignore + @Disabled @WithMockUser @Test public void defaultRequestOverridesWithMockUser() throws Exception { diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLoginTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLoginTests.java index e236a9295f..9dea5175bf 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLoginTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLoginTests.java @@ -18,8 +18,8 @@ package org.springframework.security.test.web.servlet.request; import java.util.Arrays; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; @@ -44,7 +44,7 @@ public class SecurityMockMvcRequestBuildersFormLoginTests { private MockServletContext servletContext; - @Before + @BeforeEach public void setup() { this.servletContext = new MockServletContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLogoutTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLogoutTests.java index dfdcd71507..df6e7cfef2 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLogoutTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLogoutTests.java @@ -18,8 +18,8 @@ package org.springframework.security.test.web.servlet.request; import java.util.Arrays; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; @@ -44,7 +44,7 @@ public class SecurityMockMvcRequestBuildersFormLogoutTests { private MockServletContext servletContext; - @Before + @BeforeEach public void setup() { this.servletContext = new MockServletContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests.java index 63e7b6c177..af862ca10a 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.request; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -28,7 +28,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -42,7 +42,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests.Config.class) @WebAppConfiguration public class SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests { @@ -52,7 +52,7 @@ public class SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsAuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsAuthenticationTests.java index d3543d9a61..924d086f66 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsAuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsAuthenticationTests.java @@ -18,15 +18,15 @@ package org.springframework.security.test.web.servlet.request; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.core.Authentication; @@ -41,7 +41,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockMvcRequestPostProcessorsAuthenticationTests { @Captor @@ -58,14 +58,14 @@ public class SecurityMockMvcRequestPostProcessorsAuthenticationTests { @Mock private MockedStatic webTestUtils; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.webTestUtils.when(() -> WebTestUtils.getSecurityContextRepository(this.request)) .thenReturn(this.repository); } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCertificateTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCertificateTests.java index 22b3ccb895..c6edafd37e 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCertificateTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCertificateTests.java @@ -18,18 +18,18 @@ package org.springframework.security.test.web.servlet.request; import java.security.cert.X509Certificate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.x509; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockMvcRequestPostProcessorsCertificateTests { @Mock @@ -37,7 +37,7 @@ public class SecurityMockMvcRequestPostProcessorsCertificateTests { private MockHttpServletRequest request; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfDebugFilterTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfDebugFilterTests.java index b74fd99528..acb81a8134 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfDebugFilterTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfDebugFilterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.test.web.servlet.request; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockHttpServletRequest; @@ -29,14 +29,14 @@ import org.springframework.security.test.web.support.WebTestUtils; import org.springframework.security.web.csrf.CookieCsrfTokenRepository; import org.springframework.security.web.csrf.CsrfTokenRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.web.context.WebApplicationContext; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class SecurityMockMvcRequestPostProcessorsCsrfDebugFilterTests { diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfTests.java index 7118bf8889..9b7240c94d 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfTests.java @@ -25,9 +25,9 @@ import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockHttpServletRequest; @@ -41,7 +41,7 @@ import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.csrf.CsrfToken; import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; @@ -59,7 +59,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class SecurityMockMvcRequestPostProcessorsCsrfTests { @@ -75,7 +75,7 @@ public class SecurityMockMvcRequestPostProcessorsCsrfTests { MockMvc mockMvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mockMvc = MockMvcBuilders diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsDigestTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsDigestTests.java index 5c06373a90..e21d6ed557 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsDigestTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsDigestTests.java @@ -22,9 +22,9 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -51,7 +51,7 @@ public class SecurityMockMvcRequestPostProcessorsDigestTests { private DigestAuthenticationEntryPoint entryPoint; - @Before + @BeforeEach public void setup() { this.password = "password"; this.request = new MockHttpServletRequest(); @@ -65,7 +65,7 @@ public class SecurityMockMvcRequestPostProcessorsDigestTests { this.filter.afterPropertiesSet(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsJwtTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsJwtTests.java index 5b7dd1a042..be4975be47 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsJwtTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsJwtTests.java @@ -21,14 +21,14 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockServletContext; @@ -60,7 +60,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock * @author Josh Cummings * @since 5.2 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockMvcRequestPostProcessorsJwtTests { @Captor @@ -77,7 +77,7 @@ public class SecurityMockMvcRequestPostProcessorsJwtTests { @Mock private GrantedAuthority authority2; - @Before + @BeforeEach public void setup() { SecurityContextPersistenceFilter filter = new SecurityContextPersistenceFilter(this.repository); MockServletContext servletContext = new MockServletContext(); @@ -87,7 +87,7 @@ public class SecurityMockMvcRequestPostProcessorsJwtTests { WebTestUtils.setSecurityContextRepository(this.request, this.repository); } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOAuth2ClientTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOAuth2ClientTests.java index ce6557f374..2d55658177 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOAuth2ClientTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOAuth2ClientTests.java @@ -18,10 +18,10 @@ package org.springframework.security.test.web.servlet.request; import javax.servlet.http.HttpServletRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -40,7 +40,7 @@ import org.springframework.security.oauth2.core.OAuth2AccessToken; import org.springframework.security.oauth2.core.TestOAuth2AccessTokens; import org.springframework.security.test.context.TestSecurityContextHolder; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -66,7 +66,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Josh Cummings * @since 5.3 */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class SecurityMockMvcRequestPostProcessorsOAuth2ClientTests { @@ -76,7 +76,7 @@ public class SecurityMockMvcRequestPostProcessorsOAuth2ClientTests { MockMvc mvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mvc = MockMvcBuilders @@ -86,7 +86,7 @@ public class SecurityMockMvcRequestPostProcessorsOAuth2ClientTests { // @formatter:on } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOAuth2LoginTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOAuth2LoginTests.java index f5307845af..bef554d9f9 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOAuth2LoginTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOAuth2LoginTests.java @@ -22,9 +22,9 @@ import java.util.List; import java.util.Optional; import java.util.stream.Collectors; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -43,7 +43,7 @@ import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepo import org.springframework.security.oauth2.core.user.DefaultOAuth2User; import org.springframework.security.oauth2.core.user.OAuth2User; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -66,7 +66,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Josh Cummings * @since 5.3 */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class SecurityMockMvcRequestPostProcessorsOAuth2LoginTests { @@ -76,7 +76,7 @@ public class SecurityMockMvcRequestPostProcessorsOAuth2LoginTests { MockMvc mvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mvc = MockMvcBuilders diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOidcLoginTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOidcLoginTests.java index 91fa711355..3946ae2df0 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOidcLoginTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOidcLoginTests.java @@ -20,10 +20,10 @@ import java.util.Collection; import java.util.List; import java.util.stream.Collectors; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -44,7 +44,7 @@ import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser; import org.springframework.security.oauth2.core.oidc.user.OidcUser; import org.springframework.security.test.context.TestSecurityContextHolder; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -67,7 +67,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Josh Cummings * @since 5.3 */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class SecurityMockMvcRequestPostProcessorsOidcLoginTests { @@ -77,7 +77,7 @@ public class SecurityMockMvcRequestPostProcessorsOidcLoginTests { MockMvc mvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mvc = MockMvcBuilders @@ -87,7 +87,7 @@ public class SecurityMockMvcRequestPostProcessorsOidcLoginTests { // @formatter:on } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOpaqueTokenTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOpaqueTokenTests.java index 764f51ec1c..b6a98692c5 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOpaqueTokenTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsOpaqueTokenTests.java @@ -21,9 +21,9 @@ import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -36,7 +36,7 @@ import org.springframework.security.oauth2.core.OAuth2AuthenticatedPrincipal; import org.springframework.security.oauth2.core.TestOAuth2AuthenticatedPrincipals; import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -60,7 +60,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author Josh Cummings * @since 5.3 */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class SecurityMockMvcRequestPostProcessorsOpaqueTokenTests { @@ -70,7 +70,7 @@ public class SecurityMockMvcRequestPostProcessorsOpaqueTokenTests { MockMvc mvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mvc = MockMvcBuilders diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsSecurityContextTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsSecurityContextTests.java index 805731ee0e..afc8165b25 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsSecurityContextTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsSecurityContextTests.java @@ -18,15 +18,15 @@ package org.springframework.security.test.web.servlet.request; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.core.context.SecurityContext; @@ -40,7 +40,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.securityContext; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockMvcRequestPostProcessorsSecurityContextTests { @Captor @@ -57,14 +57,14 @@ public class SecurityMockMvcRequestPostProcessorsSecurityContextTests { @Mock private MockedStatic webTestUtils; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.webTestUtils.when(() -> WebTestUtils.getSecurityContextRepository(this.request)) .thenReturn(this.repository); } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsTestSecurityContextStatelessTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsTestSecurityContextStatelessTests.java index 2ed0a2ffc7..7a919c27c6 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsTestSecurityContextStatelessTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsTestSecurityContextStatelessTests.java @@ -18,9 +18,9 @@ package org.springframework.security.test.web.servlet.request; import javax.servlet.Filter; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -30,7 +30,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -43,7 +43,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = SecurityMockMvcRequestPostProcessorsTestSecurityContextStatelessTests.Config.class) @WebAppConfiguration public class SecurityMockMvcRequestPostProcessorsTestSecurityContextStatelessTests { @@ -56,7 +56,7 @@ public class SecurityMockMvcRequestPostProcessorsTestSecurityContextStatelessTes private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).addFilters(this.springSecurityFilterChain) .defaultRequest(get("/").with(testSecurityContext())).build(); diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsTestSecurityContextTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsTestSecurityContextTests.java index ca41b64361..a3c2f7966f 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsTestSecurityContextTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsTestSecurityContextTests.java @@ -18,13 +18,13 @@ package org.springframework.security.test.web.servlet.request; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.core.context.SecurityContext; @@ -38,7 +38,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.testSecurityContext; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockMvcRequestPostProcessorsTestSecurityContextTests { @Mock @@ -52,14 +52,14 @@ public class SecurityMockMvcRequestPostProcessorsTestSecurityContextTests { private MockHttpServletRequest request; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.webTestUtils.when(() -> WebTestUtils.getSecurityContextRepository(this.request)) .thenReturn(this.repository); } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsUserDetailsTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsUserDetailsTests.java index c5613afd08..bbd7c98c97 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsUserDetailsTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsUserDetailsTests.java @@ -18,15 +18,15 @@ package org.springframework.security.test.web.servlet.request; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -42,7 +42,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockMvcRequestPostProcessorsUserDetailsTests { @Captor @@ -59,14 +59,14 @@ public class SecurityMockMvcRequestPostProcessorsUserDetailsTests { @Mock private MockedStatic webTestUtils; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.webTestUtils.when(() -> WebTestUtils.getSecurityContextRepository(this.request)) .thenReturn(this.repository); } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsUserTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsUserTests.java index 6f0056333c..f7e877d59c 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsUserTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsUserTests.java @@ -21,15 +21,15 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockedStatic; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -46,7 +46,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockMvcRequestPostProcessorsUserTests { @Captor @@ -66,14 +66,14 @@ public class SecurityMockMvcRequestPostProcessorsUserTests { @Mock private MockedStatic webTestUtils; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.webTestUtils.when(() -> WebTestUtils.getSecurityContextRepository(this.request)) .thenReturn(this.repository); } - @After + @AfterEach public void cleanup() { TestSecurityContextHolder.clearContext(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/response/Gh3409Tests.java b/test/src/test/java/org/springframework/security/test/web/servlet/response/Gh3409Tests.java index a4c3f8869c..1d6beec0c4 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/response/Gh3409Tests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/response/Gh3409Tests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.response; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -26,7 +26,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.context.SecurityContextImpl; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -42,7 +42,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder * @author Rob Winch * @since 4.1 */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration @WebAppConfiguration public class Gh3409Tests { @@ -52,7 +52,7 @@ public class Gh3409Tests { private MockMvc mockMvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mockMvc = MockMvcBuilders diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/response/SecurityMockMvcResultMatchersTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/response/SecurityMockMvcResultMatchersTests.java index 336206077c..cda6e99304 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/response/SecurityMockMvcResultMatchersTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/response/SecurityMockMvcResultMatchersTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.response; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -30,7 +30,7 @@ import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.provisioning.InMemoryUserDetailsManager; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -45,7 +45,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated; import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = SecurityMockMvcResultMatchersTests.Config.class) @WebAppConfiguration public class SecurityMockMvcResultMatchersTests { @@ -55,7 +55,7 @@ public class SecurityMockMvcResultMatchersTests { private MockMvc mockMvc; - @Before + @BeforeEach public void setup() { // @formatter:off this.mockMvc = MockMvcBuilders diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/response/SecurityMockWithAuthoritiesMvcResultMatchersTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/response/SecurityMockWithAuthoritiesMvcResultMatchersTests.java index 3341b83972..b8a25b4b5f 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/response/SecurityMockWithAuthoritiesMvcResultMatchersTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/response/SecurityMockWithAuthoritiesMvcResultMatchersTests.java @@ -19,9 +19,9 @@ package org.springframework.security.test.web.servlet.response; import java.util.ArrayList; import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -33,7 +33,7 @@ import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.provisioning.InMemoryUserDetailsManager; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -47,7 +47,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated; import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = SecurityMockWithAuthoritiesMvcResultMatchersTests.Config.class) @WebAppConfiguration public class SecurityMockWithAuthoritiesMvcResultMatchersTests { @@ -57,7 +57,7 @@ public class SecurityMockWithAuthoritiesMvcResultMatchersTests { private MockMvc mockMvc; - @Before + @BeforeEach public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/setup/SecurityMockMvcConfigurerTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/setup/SecurityMockMvcConfigurerTests.java index 86f5fd2d4f..80bf54749b 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/setup/SecurityMockMvcConfigurerTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/setup/SecurityMockMvcConfigurerTests.java @@ -19,12 +19,12 @@ package org.springframework.security.test.web.servlet.setup; import javax.servlet.Filter; import javax.servlet.ServletContext; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.config.BeanIds; import org.springframework.test.web.servlet.setup.ConfigurableMockMvcBuilder; @@ -37,7 +37,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityMockMvcConfigurerTests { @Mock @@ -55,7 +55,7 @@ public class SecurityMockMvcConfigurerTests { @Mock private ServletContext servletContext; - @Before + @BeforeEach public void setup() { given(this.context.getServletContext()).willReturn(this.servletContext); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/setup/SecurityMockMvcConfigurersTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/setup/SecurityMockMvcConfigurersTests.java index 089e5dc8b1..5c964ec6eb 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/setup/SecurityMockMvcConfigurersTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/setup/SecurityMockMvcConfigurersTests.java @@ -18,15 +18,15 @@ package org.springframework.security.test.web.servlet.setup; import javax.servlet.Filter; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.users.AuthenticationTestConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -41,7 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * @author Rob Winch */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @WebAppConfiguration public class SecurityMockMvcConfigurersTests { diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/CsrfShowcaseTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/CsrfShowcaseTests.java index 92a9e392ae..dc43a1810c 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/CsrfShowcaseTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/CsrfShowcaseTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.csrf; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -26,7 +26,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -39,7 +39,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = CsrfShowcaseTests.Config.class) @WebAppConfiguration public class CsrfShowcaseTests { @@ -49,7 +49,7 @@ public class CsrfShowcaseTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/CustomCsrfShowcaseTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/CustomCsrfShowcaseTests.java index c0382f7eaa..4fba1bef12 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/CustomCsrfShowcaseTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/CustomCsrfShowcaseTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.csrf; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -29,7 +29,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur import org.springframework.security.web.csrf.CsrfTokenRepository; import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -43,7 +43,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = CustomCsrfShowcaseTests.Config.class) @WebAppConfiguration public class CustomCsrfShowcaseTests { @@ -56,7 +56,7 @@ public class CustomCsrfShowcaseTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).defaultRequest(get("/").with(csrf())) .apply(springSecurity()).build(); diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/DefaultCsrfShowcaseTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/DefaultCsrfShowcaseTests.java index 136852f546..54d97a0c65 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/DefaultCsrfShowcaseTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/csrf/DefaultCsrfShowcaseTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.csrf; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -26,7 +26,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -40,7 +40,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = DefaultCsrfShowcaseTests.Config.class) @WebAppConfiguration public class DefaultCsrfShowcaseTests { @@ -50,7 +50,7 @@ public class DefaultCsrfShowcaseTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).defaultRequest(get("/").with(csrf())) .apply(springSecurity()).build(); diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java index 4a3d138737..6f2bc1e31c 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.login; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -30,7 +30,7 @@ import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.provisioning.InMemoryUserDetailsManager; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -46,7 +46,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = AuthenticationTests.Config.class) @WebAppConfiguration public class AuthenticationTests { @@ -56,7 +56,7 @@ public class AuthenticationTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()) .defaultRequest(get("/").accept(MediaType.TEXT_HTML)).build(); diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/CustomConfigAuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/CustomConfigAuthenticationTests.java index d58e832673..74fbc0c8fd 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/CustomConfigAuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/CustomConfigAuthenticationTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.login; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -32,7 +32,7 @@ import org.springframework.security.provisioning.InMemoryUserDetailsManager; import org.springframework.security.web.context.HttpSessionSecurityContextRepository; import org.springframework.security.web.context.SecurityContextRepository; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = CustomConfigAuthenticationTests.Config.class) @WebAppConfiguration public class CustomConfigAuthenticationTests { @@ -61,7 +61,7 @@ public class CustomConfigAuthenticationTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/CustomLoginRequestBuilderAuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/CustomLoginRequestBuilderAuthenticationTests.java index a52b469534..dff87ed51f 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/CustomLoginRequestBuilderAuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/CustomLoginRequestBuilderAuthenticationTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.login; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -31,7 +31,7 @@ import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.provisioning.InMemoryUserDetailsManager; import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.FormLoginRequestBuilder; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -45,7 +45,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = CustomLoginRequestBuilderAuthenticationTests.Config.class) @WebAppConfiguration public class CustomLoginRequestBuilderAuthenticationTests { @@ -55,7 +55,7 @@ public class CustomLoginRequestBuilderAuthenticationTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/DefaultfSecurityRequestsTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/DefaultfSecurityRequestsTests.java index 591042179d..a8e1f163bf 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/DefaultfSecurityRequestsTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/DefaultfSecurityRequestsTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.secured; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -26,7 +26,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -41,7 +41,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = DefaultfSecurityRequestsTests.Config.class) @WebAppConfiguration public class DefaultfSecurityRequestsTests { @@ -51,7 +51,7 @@ public class DefaultfSecurityRequestsTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context) .defaultRequest(get("/").with(user("user").roles("ADMIN"))).apply(springSecurity()).build(); diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/SecurityRequestsTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/SecurityRequestsTests.java index 71f1947496..36de188c8e 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/SecurityRequestsTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/SecurityRequestsTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.secured; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -31,7 +31,7 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -45,7 +45,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = SecurityRequestsTests.Config.class) @WebAppConfiguration public class SecurityRequestsTests { @@ -58,7 +58,7 @@ public class SecurityRequestsTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserAuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserAuthenticationTests.java index e95bdd1816..6933d0f272 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserAuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserAuthenticationTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.secured; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -28,7 +28,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -39,7 +39,7 @@ import static org.springframework.security.test.web.servlet.response.SecurityMoc import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = WithUserAuthenticationTests.Config.class) @WebAppConfiguration public class WithUserAuthenticationTests { @@ -49,7 +49,7 @@ public class WithUserAuthenticationTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(SecurityMockMvcConfigurers.springSecurity()) .build(); diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserClassLevelAuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserClassLevelAuthenticationTests.java index d9906782c0..8bdb234a73 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserClassLevelAuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserClassLevelAuthenticationTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.secured; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -28,7 +28,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur import org.springframework.security.test.context.support.WithAnonymousUser; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -41,7 +41,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = WithUserClassLevelAuthenticationTests.Config.class) @WebAppConfiguration @WithMockUser(roles = "ADMIN") @@ -52,7 +52,7 @@ public class WithUserClassLevelAuthenticationTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsAuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsAuthenticationTests.java index eda6e95166..dd23c2e5f7 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsAuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsAuthenticationTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.secured; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -29,7 +29,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -41,7 +41,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = WithUserDetailsAuthenticationTests.Config.class) @WebAppConfiguration public class WithUserDetailsAuthenticationTests { @@ -51,7 +51,7 @@ public class WithUserDetailsAuthenticationTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsClassLevelAuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsClassLevelAuthenticationTests.java index 0fb8741231..36daa9b406 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsClassLevelAuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsClassLevelAuthenticationTests.java @@ -16,9 +16,9 @@ package org.springframework.security.test.web.servlet.showcase.secured; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -29,7 +29,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -41,7 +41,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(classes = WithUserDetailsClassLevelAuthenticationTests.Config.class) @WebAppConfiguration @WithUserDetails("admin") @@ -52,7 +52,7 @@ public class WithUserDetailsClassLevelAuthenticationTests { private MockMvc mvc; - @Before + @BeforeEach public void setup() { this.mvc = MockMvcBuilders.webAppContextSetup(this.context).apply(springSecurity()).build(); } diff --git a/test/src/test/java/org/springframework/security/test/web/support/WebTestUtilsTests.java b/test/src/test/java/org/springframework/security/test/web/support/WebTestUtilsTests.java index 874e6c9f1c..d8a1c6dee4 100644 --- a/test/src/test/java/org/springframework/security/test/web/support/WebTestUtilsTests.java +++ b/test/src/test/java/org/springframework/security/test/web/support/WebTestUtilsTests.java @@ -16,12 +16,12 @@ package org.springframework.security.test.web.support; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Configuration; @@ -44,7 +44,7 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon import static org.assertj.core.api.Assertions.assertThat; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class WebTestUtilsTests { @Mock @@ -57,12 +57,12 @@ public class WebTestUtilsTests { private ConfigurableApplicationContext context; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); } - @After + @AfterEach public void cleanup() { if (this.context != null) { this.context.close(); diff --git a/web/src/test/java/org/springframework/security/web/DefaultRedirectStrategyTests.java b/web/src/test/java/org/springframework/security/web/DefaultRedirectStrategyTests.java index 0de7aa003a..e1a95641fb 100644 --- a/web/src/test/java/org/springframework/security/web/DefaultRedirectStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/DefaultRedirectStrategyTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; 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 e41de62297..59db2f705f 100644 --- a/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java +++ b/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java @@ -27,9 +27,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.springframework.mock.web.MockHttpServletRequest; @@ -71,7 +71,7 @@ public class FilterChainProxyTests { private Filter filter; - @Before + @BeforeEach public void setup() throws Exception { this.matcher = mock(RequestMatcher.class); this.filter = mock(Filter.class); @@ -90,7 +90,7 @@ public class FilterChainProxyTests { this.chain = mock(FilterChain.class); } - @After + @AfterEach public void teardown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/FilterInvocationTests.java b/web/src/test/java/org/springframework/security/web/FilterInvocationTests.java index 5f1ceed22c..5f4347a520 100644 --- a/web/src/test/java/org/springframework/security/web/FilterInvocationTests.java +++ b/web/src/test/java/org/springframework/security/web/FilterInvocationTests.java @@ -20,7 +20,7 @@ import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/PortMapperImplTests.java b/web/src/test/java/org/springframework/security/web/PortMapperImplTests.java index eff5866af9..7204702da5 100644 --- a/web/src/test/java/org/springframework/security/web/PortMapperImplTests.java +++ b/web/src/test/java/org/springframework/security/web/PortMapperImplTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/web/src/test/java/org/springframework/security/web/PortResolverImplTests.java b/web/src/test/java/org/springframework/security/web/PortResolverImplTests.java index 6d46e35ef6..fef8687c1f 100644 --- a/web/src/test/java/org/springframework/security/web/PortResolverImplTests.java +++ b/web/src/test/java/org/springframework/security/web/PortResolverImplTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/RequestMatcherRedirectFilterTests.java b/web/src/test/java/org/springframework/security/web/RequestMatcherRedirectFilterTests.java index 1bb76e243c..5603f00a2f 100644 --- a/web/src/test/java/org/springframework/security/web/RequestMatcherRedirectFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/RequestMatcherRedirectFilterTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web; import javax.servlet.FilterChain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletRequest; 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 54dcc2b891..a045971620 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 @@ -16,8 +16,8 @@ package org.springframework.security.web.access; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; import org.springframework.security.access.AccessDecisionManager; @@ -54,7 +54,7 @@ public class DefaultWebInvocationPrivilegeEvaluatorTests { private FilterSecurityInterceptor interceptor; - @Before + @BeforeEach public final void setUp() { this.interceptor = new FilterSecurityInterceptor(); this.ods = mock(FilterInvocationSecurityMetadataSource.class); diff --git a/web/src/test/java/org/springframework/security/web/access/DelegatingAccessDeniedHandlerTests.java b/web/src/test/java/org/springframework/security/web/access/DelegatingAccessDeniedHandlerTests.java index cc97879021..9e93d66ded 100644 --- a/web/src/test/java/org/springframework/security/web/access/DelegatingAccessDeniedHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/access/DelegatingAccessDeniedHandlerTests.java @@ -21,11 +21,11 @@ import java.util.LinkedHashMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.web.csrf.CsrfException; @@ -36,7 +36,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingAccessDeniedHandlerTests { @Mock @@ -58,7 +58,7 @@ public class DelegatingAccessDeniedHandlerTests { private DelegatingAccessDeniedHandler handler; - @Before + @BeforeEach public void setup() { this.handlers = new LinkedHashMap<>(); } 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 3269e20cb1..9fd0888540 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 @@ -25,9 +25,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; @@ -64,8 +64,8 @@ import static org.mockito.Mockito.verifyZeroInteractions; */ public class ExceptionTranslationFilterTests { - @After - @Before + @AfterEach + @BeforeEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/access/RequestMatcherDelegatingAccessDeniedHandlerTests.java b/web/src/test/java/org/springframework/security/web/access/RequestMatcherDelegatingAccessDeniedHandlerTests.java index c3bfbd4c7e..bf24389b19 100644 --- a/web/src/test/java/org/springframework/security/web/access/RequestMatcherDelegatingAccessDeniedHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/access/RequestMatcherDelegatingAccessDeniedHandlerTests.java @@ -20,8 +20,8 @@ import java.util.LinkedHashMap; import javax.servlet.http.HttpServletRequest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.web.util.matcher.RequestMatcher; @@ -44,7 +44,7 @@ public class RequestMatcherDelegatingAccessDeniedHandlerTests { private HttpServletRequest request; - @Before + @BeforeEach public void setup() { this.accessDeniedHandler = mock(AccessDeniedHandler.class); this.deniedHandlers = new LinkedHashMap<>(); diff --git a/web/src/test/java/org/springframework/security/web/access/channel/ChannelDecisionManagerImplTests.java b/web/src/test/java/org/springframework/security/web/access/channel/ChannelDecisionManagerImplTests.java index e180b9b0fd..20fd436a96 100644 --- a/web/src/test/java/org/springframework/security/web/access/channel/ChannelDecisionManagerImplTests.java +++ b/web/src/test/java/org/springframework/security/web/access/channel/ChannelDecisionManagerImplTests.java @@ -24,7 +24,7 @@ import java.util.Vector; import javax.servlet.FilterChain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/access/channel/ChannelProcessingFilterTests.java b/web/src/test/java/org/springframework/security/web/access/channel/ChannelProcessingFilterTests.java index a436f3fdfa..d2f10d6333 100644 --- a/web/src/test/java/org/springframework/security/web/access/channel/ChannelProcessingFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/access/channel/ChannelProcessingFilterTests.java @@ -21,7 +21,7 @@ import java.util.Collection; import javax.servlet.FilterChain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/access/channel/InsecureChannelProcessorTests.java b/web/src/test/java/org/springframework/security/web/access/channel/InsecureChannelProcessorTests.java index a27b459db9..fabc67814e 100644 --- a/web/src/test/java/org/springframework/security/web/access/channel/InsecureChannelProcessorTests.java +++ b/web/src/test/java/org/springframework/security/web/access/channel/InsecureChannelProcessorTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.access.channel; import javax.servlet.FilterChain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/access/channel/RetryWithHttpEntryPointTests.java b/web/src/test/java/org/springframework/security/web/access/channel/RetryWithHttpEntryPointTests.java index b2114ef85b..377c5d6f8f 100644 --- a/web/src/test/java/org/springframework/security/web/access/channel/RetryWithHttpEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/access/channel/RetryWithHttpEntryPointTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.access.channel; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/access/channel/RetryWithHttpsEntryPointTests.java b/web/src/test/java/org/springframework/security/web/access/channel/RetryWithHttpsEntryPointTests.java index d65f9a980d..093affbd15 100644 --- a/web/src/test/java/org/springframework/security/web/access/channel/RetryWithHttpsEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/access/channel/RetryWithHttpsEntryPointTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.access.channel; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/access/channel/SecureChannelProcessorTests.java b/web/src/test/java/org/springframework/security/web/access/channel/SecureChannelProcessorTests.java index ffc35f0bdf..46f0cb7fdc 100644 --- a/web/src/test/java/org/springframework/security/web/access/channel/SecureChannelProcessorTests.java +++ b/web/src/test/java/org/springframework/security/web/access/channel/SecureChannelProcessorTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.access.channel; import javax.servlet.FilterChain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/access/expression/AbstractVariableEvaluationContextPostProcessorTests.java b/web/src/test/java/org/springframework/security/web/access/expression/AbstractVariableEvaluationContextPostProcessorTests.java index 0e1dec1d1b..fad49c48d5 100644 --- a/web/src/test/java/org/springframework/security/web/access/expression/AbstractVariableEvaluationContextPostProcessorTests.java +++ b/web/src/test/java/org/springframework/security/web/access/expression/AbstractVariableEvaluationContextPostProcessorTests.java @@ -21,8 +21,8 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.expression.EvaluationContext; import org.springframework.expression.spel.support.StandardEvaluationContext; @@ -52,7 +52,7 @@ public class AbstractVariableEvaluationContextPostProcessorTests { EvaluationContext context; - @Before + @BeforeEach public void setup() { this.processor = new VariableEvaluationContextPostProcessor(); this.request = new MockHttpServletRequest(); diff --git a/web/src/test/java/org/springframework/security/web/access/expression/DefaultWebSecurityExpressionHandlerTests.java b/web/src/test/java/org/springframework/security/web/access/expression/DefaultWebSecurityExpressionHandlerTests.java index 88998fd95f..78f5c2dce1 100644 --- a/web/src/test/java/org/springframework/security/web/access/expression/DefaultWebSecurityExpressionHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/access/expression/DefaultWebSecurityExpressionHandlerTests.java @@ -16,12 +16,12 @@ package org.springframework.security.web.access.expression; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.StaticApplicationContext; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DefaultWebSecurityExpressionHandlerTests { @Mock @@ -53,12 +53,12 @@ public class DefaultWebSecurityExpressionHandlerTests { private DefaultWebSecurityExpressionHandler handler; - @Before + @BeforeEach public void setup() { this.handler = new DefaultWebSecurityExpressionHandler(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/access/expression/DelegatingEvaluationContextTests.java b/web/src/test/java/org/springframework/security/web/access/expression/DelegatingEvaluationContextTests.java index 355dd768df..fb75cf8208 100644 --- a/web/src/test/java/org/springframework/security/web/access/expression/DelegatingEvaluationContextTests.java +++ b/web/src/test/java/org/springframework/security/web/access/expression/DelegatingEvaluationContextTests.java @@ -19,11 +19,11 @@ package org.springframework.security.web.access.expression; import java.util.ArrayList; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.expression.BeanResolver; import org.springframework.expression.ConstructorResolver; @@ -43,7 +43,7 @@ import static org.mockito.Mockito.verify; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingEvaluationContextTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSourceTests.java b/web/src/test/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSourceTests.java index e4d292cbc9..b6c2b9b2de 100644 --- a/web/src/test/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSourceTests.java +++ b/web/src/test/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSourceTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.access.expression; import java.util.Collection; import java.util.LinkedHashMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.access.SecurityConfig; diff --git a/web/src/test/java/org/springframework/security/web/access/expression/WebExpressionVoterTests.java b/web/src/test/java/org/springframework/security/web/access/expression/WebExpressionVoterTests.java index 8f8a5ab887..80c5a82291 100644 --- a/web/src/test/java/org/springframework/security/web/access/expression/WebExpressionVoterTests.java +++ b/web/src/test/java/org/springframework/security/web/access/expression/WebExpressionVoterTests.java @@ -23,7 +23,7 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import org.aopalliance.intercept.MethodInvocation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; diff --git a/web/src/test/java/org/springframework/security/web/access/expression/WebSecurityExpressionRootTests.java b/web/src/test/java/org/springframework/security/web/access/expression/WebSecurityExpressionRootTests.java index f6394360fc..85574abc08 100644 --- a/web/src/test/java/org/springframework/security/web/access/expression/WebSecurityExpressionRootTests.java +++ b/web/src/test/java/org/springframework/security/web/access/expression/WebSecurityExpressionRootTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.access.expression; import javax.servlet.FilterChain; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.core.Authentication; diff --git a/web/src/test/java/org/springframework/security/web/access/intercept/AuthorizationFilterTests.java b/web/src/test/java/org/springframework/security/web/access/intercept/AuthorizationFilterTests.java index bbddf92f83..b2b22c5666 100644 --- a/web/src/test/java/org/springframework/security/web/access/intercept/AuthorizationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/access/intercept/AuthorizationFilterTests.java @@ -21,8 +21,8 @@ import java.util.function.Supplier; import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.mock.web.MockHttpServletRequest; @@ -53,7 +53,7 @@ import static org.mockito.Mockito.verifyNoInteractions; */ public class AuthorizationFilterTests { - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/access/intercept/DefaultFilterInvocationSecurityMetadataSourceTests.java b/web/src/test/java/org/springframework/security/web/access/intercept/DefaultFilterInvocationSecurityMetadataSourceTests.java index 56da271c95..01c368e286 100644 --- a/web/src/test/java/org/springframework/security/web/access/intercept/DefaultFilterInvocationSecurityMetadataSourceTests.java +++ b/web/src/test/java/org/springframework/security/web/access/intercept/DefaultFilterInvocationSecurityMetadataSourceTests.java @@ -21,7 +21,7 @@ import java.util.LinkedHashMap; import javax.servlet.FilterChain; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; 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 72b1bdee09..ee6ce48ddc 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 @@ -20,9 +20,9 @@ import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; import org.springframework.mock.web.MockFilterChain; @@ -75,7 +75,7 @@ public class FilterSecurityInterceptorTests { private ApplicationEventPublisher publisher; - @Before + @BeforeEach public final void setUp() { this.interceptor = new FilterSecurityInterceptor(); this.am = mock(AuthenticationManager.class); @@ -91,7 +91,7 @@ public class FilterSecurityInterceptorTests { SecurityContextHolder.clearContext(); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/access/intercept/RequestKeyTests.java b/web/src/test/java/org/springframework/security/web/access/intercept/RequestKeyTests.java index a311caa459..9e81c8c6d1 100644 --- a/web/src/test/java/org/springframework/security/web/access/intercept/RequestKeyTests.java +++ b/web/src/test/java/org/springframework/security/web/access/intercept/RequestKeyTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.access.intercept; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/web/src/test/java/org/springframework/security/web/access/intercept/RequestMatcherDelegatingAuthorizationManagerTests.java b/web/src/test/java/org/springframework/security/web/access/intercept/RequestMatcherDelegatingAuthorizationManagerTests.java index 59e8c857d0..829866340a 100644 --- a/web/src/test/java/org/springframework/security/web/access/intercept/RequestMatcherDelegatingAuthorizationManagerTests.java +++ b/web/src/test/java/org/springframework/security/web/access/intercept/RequestMatcherDelegatingAuthorizationManagerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.access.intercept; import java.util.function.Supplier; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.authentication.TestingAuthenticationToken; diff --git a/web/src/test/java/org/springframework/security/web/authentication/AbstractAuthenticationProcessingFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/AbstractAuthenticationProcessingFilterTests.java index 2ba221c1a5..c41c12eab8 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/AbstractAuthenticationProcessingFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/AbstractAuthenticationProcessingFilterTests.java @@ -24,9 +24,9 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterConfig; import org.springframework.mock.web.MockHttpServletRequest; @@ -80,7 +80,7 @@ public class AbstractAuthenticationProcessingFilterTests { return request; } - @Before + @BeforeEach public void setUp() { this.successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); this.successHandler.setDefaultTargetUrl("/logged_in.jsp"); @@ -89,7 +89,7 @@ public class AbstractAuthenticationProcessingFilterTests { SecurityContextHolder.clearContext(); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/AnonymousAuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/AnonymousAuthenticationFilterTests.java index 6dc8ec5f8c..e8cef30504 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/AnonymousAuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/AnonymousAuthenticationFilterTests.java @@ -25,9 +25,9 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -54,8 +54,8 @@ public class AnonymousAuthenticationFilterTests { filter.doFilter(request, response, filterChain); } - @Before - @After + @BeforeEach + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } 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 3d32c4c4c9..e4f93f4951 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 @@ -22,12 +22,12 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockFilterChain; @@ -55,7 +55,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Sergey Bespalov * @since 5.2.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthenticationFilterTests { @Mock @@ -76,12 +76,12 @@ public class AuthenticationFilterTests { @Mock private RequestMatcher requestMatcher; - @Before + @BeforeEach public void setup() { given(this.authenticationManagerResolver.resolve(any())).willReturn(this.authenticationManager); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/DefaultLoginPageGeneratingFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/DefaultLoginPageGeneratingFilterTests.java index 825c9ca6b4..97fbfda406 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/DefaultLoginPageGeneratingFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/DefaultLoginPageGeneratingFilterTests.java @@ -23,7 +23,7 @@ import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.support.MessageSourceAccessor; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointContextTests.java b/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointContextTests.java index c2abbe1a44..9e7d85270b 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointContextTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointContextTests.java @@ -19,8 +19,8 @@ package org.springframework.security.web.authentication; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -29,13 +29,13 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration( locations = "classpath:org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointTest-context.xml") public class DelegatingAuthenticationEntryPointContextTests { diff --git a/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointTests.java index fa93a45b63..761fe90bd4 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointTests.java @@ -20,8 +20,8 @@ import java.util.LinkedHashMap; import javax.servlet.http.HttpServletRequest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.web.AuthenticationEntryPoint; @@ -49,7 +49,7 @@ public class DelegatingAuthenticationEntryPointTests { private HttpServletRequest request = new MockHttpServletRequest(); - @Before + @BeforeEach public void before() { this.defaultEntryPoint = mock(AuthenticationEntryPoint.class); this.entryPoints = new LinkedHashMap<>(); 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 5117073a42..857be3a115 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 @@ -21,11 +21,11 @@ import java.util.LinkedHashMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.authentication.AccountExpiredException; import org.springframework.security.authentication.AccountStatusException; @@ -44,7 +44,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Kazuki shimizu * @since 4.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingAuthenticationFailureHandlerTests { @Mock @@ -66,7 +66,7 @@ public class DelegatingAuthenticationFailureHandlerTests { private DelegatingAuthenticationFailureHandler handler; - @Before + @BeforeEach public void setup() { this.handlers = new LinkedHashMap<>(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/ExceptionMappingAuthenticationFailureHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/ExceptionMappingAuthenticationFailureHandlerTests.java index d1bd83afc0..8251ab744f 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/ExceptionMappingAuthenticationFailureHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/ExceptionMappingAuthenticationFailureHandlerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.authentication; import java.util.HashMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticaionSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticaionSuccessHandlerTests.java index 77d3517211..39c656caf6 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticaionSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticaionSuccessHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandlerTests.java index c9e1cf10ca..920562a92f 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/ForwardAuthenticationFailureHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/HttpStatusEntryPointTests.java b/web/src/test/java/org/springframework/security/web/authentication/HttpStatusEntryPointTests.java index 110fb98455..786e7f1c0f 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/HttpStatusEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/HttpStatusEntryPointTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.authentication; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletRequest; @@ -42,7 +42,7 @@ public class HttpStatusEntryPointTests { HttpStatusEntryPoint entryPoint; @SuppressWarnings("serial") - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPointTests.java index 8f097f69ed..77b49be1a1 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPointTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.authentication; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/SavedRequestAwareAuthenticationSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/SavedRequestAwareAuthenticationSuccessHandlerTests.java index 5ebd4611aa..ff904c6c19 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/SavedRequestAwareAuthenticationSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/SavedRequestAwareAuthenticationSuccessHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationFailureHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationFailureHandlerTests.java index 732ecc0f41..d69880df36 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationFailureHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationFailureHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationSuccessHandlerTests.java index b1abd20482..904b54eb34 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationSuccessHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilterTests.java index f34586943e..9487957fa5 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/CompositeLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/CompositeLogoutHandlerTests.java index 40fc27fb11..6bc04f2eaf 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/CompositeLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/CompositeLogoutHandlerTests.java @@ -22,7 +22,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.InOrder; import org.springframework.security.core.Authentication; diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/CookieClearingLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/CookieClearingLogoutHandlerTests.java index b78dcb807e..c5b6c6e830 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/CookieClearingLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/CookieClearingLogoutHandlerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.authentication.logout; import javax.servlet.http.Cookie; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; 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 82e547d356..36c5879dc0 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 @@ -20,11 +20,11 @@ import java.util.LinkedHashMap; import javax.servlet.http.HttpServletRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.security.core.Authentication; @@ -40,7 +40,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Shazin Sadakath * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingLogoutSuccessHandlerTests { @Mock @@ -69,7 +69,7 @@ public class DelegatingLogoutSuccessHandlerTests { DelegatingLogoutSuccessHandler delegatingHandler; - @Before + @BeforeEach public void setup() { LinkedHashMap matcherToHandler = new LinkedHashMap<>(); matcherToHandler.put(this.matcher, this.handler); diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/ForwardLogoutSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/ForwardLogoutSuccessHandlerTests.java index 980ecd8f8a..f5f972ec49 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/ForwardLogoutSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/ForwardLogoutSuccessHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.logout; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/HeaderWriterLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/HeaderWriterLogoutHandlerTests.java index dd89839d44..d385777942 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/HeaderWriterLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/HeaderWriterLogoutHandlerTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.authentication.logout; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -39,7 +39,7 @@ public class HeaderWriterLogoutHandlerTests { private MockHttpServletRequest request; - @Before + @BeforeEach public void setup() { this.response = new MockHttpServletResponse(); this.request = new MockHttpServletRequest(); diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/HttpStatusReturningLogoutSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/HttpStatusReturningLogoutSuccessHandlerTests.java index 494f7e033c..8373429927 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/HttpStatusReturningLogoutSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/HttpStatusReturningLogoutSuccessHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.logout; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/LogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/LogoutHandlerTests.java index 814b009fff..e86c7223fd 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/LogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/LogoutHandlerTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.authentication.logout; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -32,7 +32,7 @@ public class LogoutHandlerTests { LogoutFilter filter; - @Before + @BeforeEach public void setUp() { this.filter = new LogoutFilter("/success", new SecurityContextLogoutHandler()); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/LogoutSuccessEventPublishingLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/LogoutSuccessEventPublishingLogoutHandlerTests.java index 69ecf1ccf6..f339fc0201 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/LogoutSuccessEventPublishingLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/LogoutSuccessEventPublishingLogoutHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.logout; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/SecurityContextLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/SecurityContextLogoutHandlerTests.java index c5a0024de5..2efb3eb96a 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/SecurityContextLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/SecurityContextLogoutHandlerTests.java @@ -16,9 +16,9 @@ package org.springframework.security.web.authentication.logout; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -42,7 +42,7 @@ public class SecurityContextLogoutHandlerTests { private SecurityContextLogoutHandler handler; - @Before + @BeforeEach public void setUp() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); @@ -53,7 +53,7 @@ public class SecurityContextLogoutHandlerTests { SecurityContextHolder.setContext(context); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/SimpleUrlLogoutSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/SimpleUrlLogoutSuccessHandlerTests.java index 4a8374a9d8..67d4c779ca 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/SimpleUrlLogoutSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/SimpleUrlLogoutSuccessHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.logout; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; 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 bf851de2ae..d32323c4e7 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 @@ -20,9 +20,9 @@ import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.springframework.mock.web.MockFilterChain; @@ -59,7 +59,7 @@ public class AbstractPreAuthenticatedProcessingFilterTests { private AbstractPreAuthenticatedProcessingFilter filter; - @Before + @BeforeEach public void createFilter() { this.filter = new AbstractPreAuthenticatedProcessingFilter() { @Override @@ -75,7 +75,7 @@ public class AbstractPreAuthenticatedProcessingFilterTests { SecurityContextHolder.clearContext(); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationProviderTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationProviderTests.java index 33b19d7ba6..671385b8f8 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationProviderTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationProviderTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.preauth; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationTokenTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationTokenTests.java index 36089ccd66..4e135f2894 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationTokenTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationTokenTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.authentication.preauth; import java.util.Collection; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsServiceTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsServiceTests.java index 504b3a4e19..12a70cea99 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsServiceTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedGrantedAuthoritiesUserDetailsServiceTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.authentication.preauth; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetailsTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetailsTests.java index f99701485a..0be25f5c26 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetailsTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetailsTests.java @@ -23,7 +23,7 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.core.GrantedAuthority; diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/RequestAttributeAuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/RequestAttributeAuthenticationFilterTests.java index 5409381137..f385d3a7a9 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/RequestAttributeAuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/RequestAttributeAuthenticationFilterTests.java @@ -16,9 +16,9 @@ package org.springframework.security.web.authentication.preauth; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.springframework.mock.web.MockFilterChain; @@ -39,8 +39,8 @@ import static org.mockito.Mockito.mock; */ public class RequestAttributeAuthenticationFilterTests { - @After - @Before + @AfterEach + @BeforeEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/header/RequestHeaderAuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/header/RequestHeaderAuthenticationFilterTests.java index 8c449384c1..900fd03997 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/header/RequestHeaderAuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/header/RequestHeaderAuthenticationFilterTests.java @@ -16,9 +16,9 @@ package org.springframework.security.web.authentication.preauth.header; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.springframework.mock.web.MockFilterChain; @@ -41,8 +41,8 @@ import static org.mockito.Mockito.mock; */ public class RequestHeaderAuthenticationFilterTests { - @After - @Before + @AfterEach + @BeforeEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java index 770f52dce5..3e7275f1b7 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java @@ -24,7 +24,7 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.core.GrantedAuthority; diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/J2eePreAuthenticatedProcessingFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/J2eePreAuthenticatedProcessingFilterTests.java index fcc462dfb8..91edaf4d14 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/J2eePreAuthenticatedProcessingFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/J2eePreAuthenticatedProcessingFilterTests.java @@ -22,7 +22,7 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java index 55c8b8fab4..e4a7e309b7 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.List; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/websphere/WebSpherePreAuthenticatedProcessingFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/websphere/WebSpherePreAuthenticatedProcessingFilterTests.java index 87b2e2e7bb..d5a9e1a8d2 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/websphere/WebSpherePreAuthenticatedProcessingFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/websphere/WebSpherePreAuthenticatedProcessingFilterTests.java @@ -18,8 +18,8 @@ package org.springframework.security.web.authentication.preauth.websphere; import javax.servlet.FilterChain; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.mockito.stubbing.Answer; import org.springframework.mock.web.MockHttpServletRequest; @@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock; */ public class WebSpherePreAuthenticatedProcessingFilterTests { - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/x509/SubjectDnX509PrincipalExtractorTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/x509/SubjectDnX509PrincipalExtractorTests.java index 5519e6ff1b..f910a2cd25 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/x509/SubjectDnX509PrincipalExtractorTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/x509/SubjectDnX509PrincipalExtractorTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.authentication.preauth.x509; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.MessageSource; import org.springframework.security.authentication.BadCredentialsException; @@ -37,7 +37,7 @@ public class SubjectDnX509PrincipalExtractorTests { SubjectDnX509PrincipalExtractor extractor; - @Before + @BeforeEach public void setUp() { this.extractor = new SubjectDnX509PrincipalExtractor(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServicesTests.java b/web/src/test/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServicesTests.java index 4cb3109940..a8912f326a 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServicesTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServicesTests.java @@ -20,8 +20,8 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.context.MessageSource; @@ -56,7 +56,7 @@ public class AbstractRememberMeServicesTests { MockUserDetailsService uds; - @Before + @BeforeEach public void setup() { this.uds = new MockUserDetailsService(joe, false); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/rememberme/JdbcTokenRepositoryImplTests.java b/web/src/test/java/org/springframework/security/web/authentication/rememberme/JdbcTokenRepositoryImplTests.java index 97546514d0..8e088aa253 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/rememberme/JdbcTokenRepositoryImplTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/rememberme/JdbcTokenRepositoryImplTests.java @@ -23,15 +23,15 @@ import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -49,7 +49,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Luke Taylor */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class JdbcTokenRepositoryImplTests { @Mock @@ -61,19 +61,19 @@ public class JdbcTokenRepositoryImplTests { private JdbcTemplate template; - @BeforeClass + @BeforeAll public static void createDataSource() { dataSource = new SingleConnectionDataSource("jdbc:hsqldb:mem:tokenrepotest", "sa", "", true); dataSource.setDriverClassName("org.hsqldb.jdbc.JDBCDriver"); } - @AfterClass + @AfterAll public static void clearDataSource() { dataSource.destroy(); dataSource = null; } - @Before + @BeforeEach public void populateDatabase() { this.repo = new JdbcTokenRepositoryImpl(); ReflectionTestUtils.setField(this.repo, "logger", this.logger); @@ -84,7 +84,7 @@ public class JdbcTokenRepositoryImplTests { + "series varchar(100) not null, token varchar(500) not null, last_used timestamp not null)"); } - @After + @AfterEach public void clearData() { this.template.execute("drop table persistent_logins"); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/rememberme/NullRememberMeServicesTests.java b/web/src/test/java/org/springframework/security/web/authentication/rememberme/NullRememberMeServicesTests.java index aa73bc10e6..e8174aaf13 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/rememberme/NullRememberMeServicesTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/rememberme/NullRememberMeServicesTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.rememberme; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.web.authentication.NullRememberMeServices; diff --git a/web/src/test/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServicesTests.java b/web/src/test/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServicesTests.java index e4b3613072..b79ef32f09 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServicesTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServicesTests.java @@ -21,8 +21,8 @@ import java.util.concurrent.TimeUnit; import javax.servlet.http.Cookie; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -41,7 +41,7 @@ public class PersistentTokenBasedRememberMeServicesTests { private MockTokenRepository repo; - @Before + @BeforeEach public void setUpData() throws Exception { this.services = new PersistentTokenBasedRememberMeServices("key", new AbstractRememberMeServicesTests.MockUserDetailsService(AbstractRememberMeServicesTests.joe, false), 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 77dfd356a8..de778a94fd 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 @@ -20,9 +20,9 @@ import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationEventPublisher; import org.springframework.mock.web.MockHttpServletRequest; @@ -54,12 +54,12 @@ public class RememberMeAuthenticationFilterTests { Authentication remembered = new TestingAuthenticationToken("remembered", "password", "ROLE_REMEMBERED"); - @Before + @BeforeEach public void setUp() { SecurityContextHolder.clearContext(); } - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServicesTests.java b/web/src/test/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServicesTests.java index d118b0f8fa..bc1aa888c1 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServicesTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServicesTests.java @@ -22,8 +22,8 @@ import javax.servlet.http.Cookie; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -58,7 +58,7 @@ public class TokenBasedRememberMeServicesTests { private TokenBasedRememberMeServices services; - @Before + @BeforeEach public void createTokenBasedRememberMeServices() { this.uds = mock(UserDetailsService.class); this.services = new TokenBasedRememberMeServices("key", this.uds); diff --git a/web/src/test/java/org/springframework/security/web/authentication/session/ChangeSessionIdAuthenticationStrategyTests.java b/web/src/test/java/org/springframework/security/web/authentication/session/ChangeSessionIdAuthenticationStrategyTests.java index c3b44f5a9d..af082f41fb 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/session/ChangeSessionIdAuthenticationStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/session/ChangeSessionIdAuthenticationStrategyTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.session; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/authentication/session/CompositeSessionAuthenticationStrategyTests.java b/web/src/test/java/org/springframework/security/web/authentication/session/CompositeSessionAuthenticationStrategyTests.java index 9660bc7dda..2aaab5a639 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/session/CompositeSessionAuthenticationStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/session/CompositeSessionAuthenticationStrategyTests.java @@ -22,10 +22,10 @@ import java.util.Collections; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.core.Authentication; @@ -39,7 +39,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CompositeSessionAuthenticationStrategyTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/authentication/session/ConcurrentSessionControlAuthenticationStrategyTests.java b/web/src/test/java/org/springframework/security/web/authentication/session/ConcurrentSessionControlAuthenticationStrategyTests.java index a96e81ce51..ee6fcc05b5 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/session/ConcurrentSessionControlAuthenticationStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/session/ConcurrentSessionControlAuthenticationStrategyTests.java @@ -20,11 +20,11 @@ import java.util.Arrays; import java.util.Collections; import java.util.Date; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -46,7 +46,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ConcurrentSessionControlAuthenticationStrategyTests { @Mock @@ -62,7 +62,7 @@ public class ConcurrentSessionControlAuthenticationStrategyTests { private ConcurrentSessionControlAuthenticationStrategy strategy; - @Before + @BeforeEach public void setup() { this.authentication = new TestingAuthenticationToken("user", "password", "ROLE_USER"); this.request = new MockHttpServletRequest(); diff --git a/web/src/test/java/org/springframework/security/web/authentication/session/RegisterSessionAuthenticationStrategyTests.java b/web/src/test/java/org/springframework/security/web/authentication/session/RegisterSessionAuthenticationStrategyTests.java index 20d0432d38..45453d4b28 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/session/RegisterSessionAuthenticationStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/session/RegisterSessionAuthenticationStrategyTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.authentication.session; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -35,7 +35,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class RegisterSessionAuthenticationStrategyTests { @Mock @@ -49,7 +49,7 @@ public class RegisterSessionAuthenticationStrategyTests { private MockHttpServletResponse response; - @Before + @BeforeEach public void setup() { this.authenticationStrategy = new RegisterSessionAuthenticationStrategy(this.registry); this.authentication = new TestingAuthenticationToken("user", "password", "ROLE_USER"); diff --git a/web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilterTests.java index 27f90723ef..1c9f5eaef4 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilterTests.java @@ -21,9 +21,9 @@ import java.util.List; import javax.servlet.FilterChain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -64,13 +64,13 @@ public class SwitchUserFilterTests { private static final List ROLES_12 = AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"); - @Before + @BeforeEach public void authenticateCurrentUser() { UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("dano", "hawaii50"); SecurityContextHolder.getContext().setAuthentication(auth); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserGrantedAuthorityTests.java b/web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserGrantedAuthorityTests.java index b1e5752b09..f51c172c40 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserGrantedAuthorityTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserGrantedAuthorityTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.switchuser; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/web/src/test/java/org/springframework/security/web/authentication/ui/DefaultLogoutPageGeneratingFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/ui/DefaultLogoutPageGeneratingFilterTests.java index 7e93bd73ab..4ab89fa99e 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/ui/DefaultLogoutPageGeneratingFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/ui/DefaultLogoutPageGeneratingFilterTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.authentication.ui; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; 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 461c795118..744f32993a 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 @@ -19,11 +19,11 @@ package org.springframework.security.web.authentication.www; import javax.servlet.http.HttpServletRequest; import org.apache.commons.codec.binary.Base64; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.authentication.AuthenticationDetailsSource; @@ -40,7 +40,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Sergey Bespalov * @since 5.2.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class BasicAuthenticationConverterTests { @Mock @@ -48,7 +48,7 @@ public class BasicAuthenticationConverterTests { private BasicAuthenticationConverter converter; - @Before + @BeforeEach public void setup() { this.converter = new BasicAuthenticationConverter(this.authenticationDetailsSource); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationEntryPointTests.java index ea6bc24ac8..0ada20dc53 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationEntryPointTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.authentication.www; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationFilterTests.java index c94e1520d5..13b265b8e0 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/www/BasicAuthenticationFilterTests.java @@ -24,9 +24,9 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; import org.apache.commons.codec.binary.Base64; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -61,7 +61,7 @@ public class BasicAuthenticationFilterTests { private AuthenticationManager manager; - @Before + @BeforeEach public void setUp() { SecurityContextHolder.clearContext(); UsernamePasswordAuthenticationToken rodRequest = new UsernamePasswordAuthenticationToken("rod", "koala"); @@ -74,7 +74,7 @@ public class BasicAuthenticationFilterTests { this.filter = new BasicAuthenticationFilter(this.manager, new BasicAuthenticationEntryPoint()); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthUtilsTests.java b/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthUtilsTests.java index 8fcaf532af..104c73f4fd 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthUtilsTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthUtilsTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.authentication.www; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.util.StringUtils; diff --git a/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationEntryPointTests.java index e33efb4e8b..94cd7b8887 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationEntryPointTests.java @@ -20,7 +20,7 @@ import java.util.Map; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilterTests.java index f12b6d8916..6168db7143 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilterTests.java @@ -26,9 +26,9 @@ import javax.servlet.ServletRequest; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -108,12 +108,12 @@ public class DigestAuthenticationFilterTests { return new String(Base64.encodeBase64(nonceValue.getBytes())); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } - @Before + @BeforeEach public void setUp() { SecurityContextHolder.clearContext(); // Create User Details Service diff --git a/web/src/test/java/org/springframework/security/web/bind/support/AuthenticationPrincipalArgumentResolverTests.java b/web/src/test/java/org/springframework/security/web/bind/support/AuthenticationPrincipalArgumentResolverTests.java index 2dabd20b2e..69cc3431a5 100644 --- a/web/src/test/java/org/springframework/security/web/bind/support/AuthenticationPrincipalArgumentResolverTests.java +++ b/web/src/test/java/org/springframework/security/web/bind/support/AuthenticationPrincipalArgumentResolverTests.java @@ -22,9 +22,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Method; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.MethodParameter; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -49,12 +49,12 @@ public class AuthenticationPrincipalArgumentResolverTests { private AuthenticationPrincipalArgumentResolver resolver; - @Before + @BeforeEach public void setup() { this.resolver = new AuthenticationPrincipalArgumentResolver(); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } 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 61a529be93..a29ef1cab7 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 @@ -22,8 +22,8 @@ import java.util.List; import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -59,7 +59,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; */ public class ConcurrentSessionFilterTests { - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/context/AbstractSecurityWebApplicationInitializerTests.java b/web/src/test/java/org/springframework/security/web/context/AbstractSecurityWebApplicationInitializerTests.java index 7d82c0b7c7..8475a2433d 100644 --- a/web/src/test/java/org/springframework/security/web/context/AbstractSecurityWebApplicationInitializerTests.java +++ b/web/src/test/java/org/springframework/security/web/context/AbstractSecurityWebApplicationInitializerTests.java @@ -28,7 +28,7 @@ import javax.servlet.FilterRegistration; import javax.servlet.ServletContext; import javax.servlet.SessionTrackingMode; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.context.annotation.Configuration; diff --git a/web/src/test/java/org/springframework/security/web/context/HttpSessionSecurityContextRepositoryTests.java b/web/src/test/java/org/springframework/security/web/context/HttpSessionSecurityContextRepositoryTests.java index cf17fe21d8..cfbe0f332f 100644 --- a/web/src/test/java/org/springframework/security/web/context/HttpSessionSecurityContextRepositoryTests.java +++ b/web/src/test/java/org/springframework/security/web/context/HttpSessionSecurityContextRepositoryTests.java @@ -32,8 +32,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import javax.servlet.http.HttpSession; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -70,7 +70,7 @@ public class HttpSessionSecurityContextRepositoryTests { private final TestingAuthenticationToken testToken = new TestingAuthenticationToken("someone", "passwd", "ROLE_A"); - @After + @AfterEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/context/SaveContextOnUpdateOrErrorResponseWrapperTests.java b/web/src/test/java/org/springframework/security/web/context/SaveContextOnUpdateOrErrorResponseWrapperTests.java index 4a30bf3f89..4c1b5f3798 100644 --- a/web/src/test/java/org/springframework/security/web/context/SaveContextOnUpdateOrErrorResponseWrapperTests.java +++ b/web/src/test/java/org/springframework/security/web/context/SaveContextOnUpdateOrErrorResponseWrapperTests.java @@ -18,12 +18,12 @@ package org.springframework.security.web.context; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.security.core.context.SecurityContext; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SaveContextOnUpdateOrErrorResponseWrapperTests { @Mock @@ -45,14 +45,14 @@ public class SaveContextOnUpdateOrErrorResponseWrapperTests { private SaveContextOnUpdateOrErrorResponseWrapperStub wrappedResponse; - @Before + @BeforeEach public void setUp() { this.response = new MockHttpServletResponse(); this.wrappedResponse = new SaveContextOnUpdateOrErrorResponseWrapperStub(this.response, true); SecurityContextHolder.setContext(this.securityContext); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/context/SecurityContextPersistenceFilterTests.java b/web/src/test/java/org/springframework/security/web/context/SecurityContextPersistenceFilterTests.java index 8a7087eefc..8ef48d12b2 100644 --- a/web/src/test/java/org/springframework/security/web/context/SecurityContextPersistenceFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/context/SecurityContextPersistenceFilterTests.java @@ -22,8 +22,8 @@ import javax.servlet.FilterChain; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -44,7 +44,7 @@ public class SecurityContextPersistenceFilterTests { TestingAuthenticationToken testToken = new TestingAuthenticationToken("someone", "passwd", "ROLE_A"); - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/context/request/async/SecurityContextCallableProcessingInterceptorTests.java b/web/src/test/java/org/springframework/security/web/context/request/async/SecurityContextCallableProcessingInterceptorTests.java index 9281ccca24..980c782f92 100644 --- a/web/src/test/java/org/springframework/security/web/context/request/async/SecurityContextCallableProcessingInterceptorTests.java +++ b/web/src/test/java/org/springframework/security/web/context/request/async/SecurityContextCallableProcessingInterceptorTests.java @@ -18,11 +18,11 @@ package org.springframework.security.web.context.request.async; import java.util.concurrent.Callable; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityContextCallableProcessingInterceptorTests { @Mock @@ -47,7 +47,7 @@ public class SecurityContextCallableProcessingInterceptorTests { @Mock private NativeWebRequest webRequest; - @After + @AfterEach public void clearSecurityContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/context/request/async/WebAsyncManagerIntegrationFilterTests.java b/web/src/test/java/org/springframework/security/web/context/request/async/WebAsyncManagerIntegrationFilterTests.java index 09fc283ec3..d2aab14969 100644 --- a/web/src/test/java/org/springframework/security/web/context/request/async/WebAsyncManagerIntegrationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/context/request/async/WebAsyncManagerIntegrationFilterTests.java @@ -22,12 +22,12 @@ import java.util.concurrent.ThreadFactory; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.task.SimpleAsyncTaskExecutor; import org.springframework.mock.web.MockFilterChain; @@ -46,7 +46,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class WebAsyncManagerIntegrationFilterTests { @Mock @@ -69,7 +69,7 @@ public class WebAsyncManagerIntegrationFilterTests { private WebAsyncManagerIntegrationFilter filter; - @Before + @BeforeEach public void setUp() { this.filterChain = new MockFilterChain(); this.threadFactory = new JoinableThreadFactory(); @@ -82,7 +82,7 @@ public class WebAsyncManagerIntegrationFilterTests { this.filter = new WebAsyncManagerIntegrationFilter(); } - @After + @AfterEach public void clearSecurityContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/csrf/CookieCsrfTokenRepositoryTests.java b/web/src/test/java/org/springframework/security/web/csrf/CookieCsrfTokenRepositoryTests.java index 722bc01a69..3b08d4318f 100644 --- a/web/src/test/java/org/springframework/security/web/csrf/CookieCsrfTokenRepositoryTests.java +++ b/web/src/test/java/org/springframework/security/web/csrf/CookieCsrfTokenRepositoryTests.java @@ -18,8 +18,8 @@ package org.springframework.security.web.csrf; import javax.servlet.http.Cookie; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -39,7 +39,7 @@ public class CookieCsrfTokenRepositoryTests { MockHttpServletRequest request; - @Before + @BeforeEach public void setup() { this.repository = new CookieCsrfTokenRepository(); this.request = new MockHttpServletRequest(); diff --git a/web/src/test/java/org/springframework/security/web/csrf/CsrfAuthenticationStrategyTests.java b/web/src/test/java/org/springframework/security/web/csrf/CsrfAuthenticationStrategyTests.java index 92392722d8..a949e3a395 100644 --- a/web/src/test/java/org/springframework/security/web/csrf/CsrfAuthenticationStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/csrf/CsrfAuthenticationStrategyTests.java @@ -19,11 +19,11 @@ package org.springframework.security.web.csrf; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -41,7 +41,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CsrfAuthenticationStrategyTests { @Mock @@ -57,7 +57,7 @@ public class CsrfAuthenticationStrategyTests { private CsrfToken generatedToken; - @Before + @BeforeEach public void setup() { this.response = new MockHttpServletResponse(); this.request = new MockHttpServletRequest(); 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 add52d1b56..b4244f228d 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 @@ -26,11 +26,11 @@ import javax.servlet.http.HttpServletResponse; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.ObjectAssert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -54,7 +54,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CsrfFilterTests { @Mock @@ -77,7 +77,7 @@ public class CsrfFilterTests { private CsrfFilter filter; - @Before + @BeforeEach public void setup() { this.token = new DefaultCsrfToken("headerName", "paramName", "csrfTokenValue"); resetRequestResponse(); diff --git a/web/src/test/java/org/springframework/security/web/csrf/CsrfLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/csrf/CsrfLogoutHandlerTests.java index 6ac8eae22c..b2b91343c7 100644 --- a/web/src/test/java/org/springframework/security/web/csrf/CsrfLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/csrf/CsrfLogoutHandlerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.csrf; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -33,7 +33,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 3.2 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CsrfLogoutHandlerTests { @Mock @@ -45,7 +45,7 @@ public class CsrfLogoutHandlerTests { private CsrfLogoutHandler handler; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/csrf/DefaultCsrfTokenTests.java b/web/src/test/java/org/springframework/security/web/csrf/DefaultCsrfTokenTests.java index dffe2ee8d3..f17542d04c 100644 --- a/web/src/test/java/org/springframework/security/web/csrf/DefaultCsrfTokenTests.java +++ b/web/src/test/java/org/springframework/security/web/csrf/DefaultCsrfTokenTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.csrf; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/web/src/test/java/org/springframework/security/web/csrf/HttpSessionCsrfTokenRepositoryTests.java b/web/src/test/java/org/springframework/security/web/csrf/HttpSessionCsrfTokenRepositoryTests.java index 3f91b5a2e5..13d9fca65d 100644 --- a/web/src/test/java/org/springframework/security/web/csrf/HttpSessionCsrfTokenRepositoryTests.java +++ b/web/src/test/java/org/springframework/security/web/csrf/HttpSessionCsrfTokenRepositoryTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.csrf; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -39,7 +39,7 @@ public class HttpSessionCsrfTokenRepositoryTests { private HttpSessionCsrfTokenRepository repo; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); 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 4aca691447..63c1859c21 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 @@ -19,12 +19,12 @@ package org.springframework.security.web.csrf; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -36,7 +36,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; /** * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class LazyCsrfTokenRepositoryTests { @Mock @@ -53,7 +53,7 @@ public class LazyCsrfTokenRepositoryTests { DefaultCsrfToken token; - @Before + @BeforeEach public void setup() { this.token = new DefaultCsrfToken("header", "param", "token"); given(this.delegate.generateToken(this.request)).willReturn(this.token); diff --git a/web/src/test/java/org/springframework/security/web/csrf/MissingCsrfTokenExceptionTests.java b/web/src/test/java/org/springframework/security/web/csrf/MissingCsrfTokenExceptionTests.java index ef84d3b5de..3ca1797827 100644 --- a/web/src/test/java/org/springframework/security/web/csrf/MissingCsrfTokenExceptionTests.java +++ b/web/src/test/java/org/springframework/security/web/csrf/MissingCsrfTokenExceptionTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.csrf; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * @author Rob Winch diff --git a/web/src/test/java/org/springframework/security/web/debug/DebugFilterTests.java b/web/src/test/java/org/springframework/security/web/debug/DebugFilterTests.java index 4639a7fdf5..0c2ed56571 100644 --- a/web/src/test/java/org/springframework/security/web/debug/DebugFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/debug/DebugFilterTests.java @@ -23,13 +23,13 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.web.FilterChainProxy; @@ -47,7 +47,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DebugFilterTests { @Captor @@ -75,7 +75,7 @@ public class DebugFilterTests { private DebugFilter filter; - @Before + @BeforeEach public void setUp() { given(this.request.getHeaderNames()).willReturn(Collections.enumeration(Collections.emptyList())); given(this.request.getServletPath()).willReturn("/login"); diff --git a/web/src/test/java/org/springframework/security/web/firewall/DefaultHttpFirewallTests.java b/web/src/test/java/org/springframework/security/web/firewall/DefaultHttpFirewallTests.java index 51507e2404..6372290c03 100644 --- a/web/src/test/java/org/springframework/security/web/firewall/DefaultHttpFirewallTests.java +++ b/web/src/test/java/org/springframework/security/web/firewall/DefaultHttpFirewallTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.firewall; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/firewall/DefaultRequestRejectedHandlerTests.java b/web/src/test/java/org/springframework/security/web/firewall/DefaultRequestRejectedHandlerTests.java index b9d0cacdef..1e668eb8b5 100644 --- a/web/src/test/java/org/springframework/security/web/firewall/DefaultRequestRejectedHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/firewall/DefaultRequestRejectedHandlerTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.firewall; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.Mockito.mock; diff --git a/web/src/test/java/org/springframework/security/web/firewall/FirewalledResponseTests.java b/web/src/test/java/org/springframework/security/web/firewall/FirewalledResponseTests.java index f7b4fc2a17..dedf238ad7 100644 --- a/web/src/test/java/org/springframework/security/web/firewall/FirewalledResponseTests.java +++ b/web/src/test/java/org/springframework/security/web/firewall/FirewalledResponseTests.java @@ -19,8 +19,8 @@ package org.springframework.security.web.firewall; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.mockito.Mockito.mock; @@ -39,7 +39,7 @@ public class FirewalledResponseTests { private FirewalledResponse fwResponse; - @Before + @BeforeEach public void setup() { this.response = mock(HttpServletResponse.class); this.fwResponse = new FirewalledResponse(this.response); diff --git a/web/src/test/java/org/springframework/security/web/firewall/HttpStatusRequestRejectedHandlerTests.java b/web/src/test/java/org/springframework/security/web/firewall/HttpStatusRequestRejectedHandlerTests.java index 32d6e3f50e..49b28796ef 100644 --- a/web/src/test/java/org/springframework/security/web/firewall/HttpStatusRequestRejectedHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/firewall/HttpStatusRequestRejectedHandlerTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.firewall; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/web/src/test/java/org/springframework/security/web/firewall/RequestWrapperTests.java b/web/src/test/java/org/springframework/security/web/firewall/RequestWrapperTests.java index 247d0e963f..4d1bd3f46f 100644 --- a/web/src/test/java/org/springframework/security/web/firewall/RequestWrapperTests.java +++ b/web/src/test/java/org/springframework/security/web/firewall/RequestWrapperTests.java @@ -23,8 +23,8 @@ import javax.servlet.RequestDispatcher; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; @@ -42,7 +42,7 @@ public class RequestWrapperTests { private static Map testPaths = new LinkedHashMap<>(); - @BeforeClass + @BeforeAll // Some of these may be unrealistic values, but we can't be sure because of the // inconsistency in the spec. public static void createTestMap() { diff --git a/web/src/test/java/org/springframework/security/web/firewall/StrictHttpFirewallTests.java b/web/src/test/java/org/springframework/security/web/firewall/StrictHttpFirewallTests.java index 3ca722f9bd..ce461e3401 100644 --- a/web/src/test/java/org/springframework/security/web/firewall/StrictHttpFirewallTests.java +++ b/web/src/test/java/org/springframework/security/web/firewall/StrictHttpFirewallTests.java @@ -21,7 +21,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.mock.web.MockHttpServletRequest; 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 76ce8510e2..712e03e01c 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 @@ -24,10 +24,10 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -47,7 +47,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 3.2 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class HeaderWriterFilterTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/header/writers/CacheControlHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/CacheControlHeadersWriterTests.java index 97a89289ec..906c96f4b2 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/CacheControlHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/CacheControlHeadersWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletRequest; @@ -37,7 +37,7 @@ public class CacheControlHeadersWriterTests { private CacheControlHeadersWriter writer; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/ClearSiteDataHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/ClearSiteDataHeaderWriterTests.java index d55b3326e5..3c8f8cd26c 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/ClearSiteDataHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/ClearSiteDataHeaderWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -39,7 +39,7 @@ public class ClearSiteDataHeaderWriterTests { private MockHttpServletResponse response; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.request.setSecure(true); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/CompositeHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/CompositeHeaderWriterTests.java index 3f57db42ac..f1ef36b15a 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/CompositeHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/CompositeHeaderWriterTests.java @@ -22,7 +22,7 @@ import java.util.Collections; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.web.header.HeaderWriter; diff --git a/web/src/test/java/org/springframework/security/web/header/writers/ContentSecurityPolicyHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/ContentSecurityPolicyHeaderWriterTests.java index 45d18315ab..d972486ee8 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/ContentSecurityPolicyHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/ContentSecurityPolicyHeaderWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -43,7 +43,7 @@ public class ContentSecurityPolicyHeaderWriterTests { private static final String CONTENT_SECURITY_POLICY_REPORT_ONLY_HEADER = "Content-Security-Policy-Report-Only"; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.request.setSecure(true); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/DelegatingRequestMatcherHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/DelegatingRequestMatcherHeaderWriterTests.java index 7e375b890c..442bcd3748 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/DelegatingRequestMatcherHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/DelegatingRequestMatcherHeaderWriterTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -36,7 +36,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingRequestMatcherHeaderWriterTests { @Mock @@ -51,7 +51,7 @@ public class DelegatingRequestMatcherHeaderWriterTests { private DelegatingRequestMatcherHeaderWriter headerWriter; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/FeaturePolicyHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/FeaturePolicyHeaderWriterTests.java index 5a88698962..08e073a005 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/FeaturePolicyHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/FeaturePolicyHeaderWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -43,7 +43,7 @@ public class FeaturePolicyHeaderWriterTests { private static final String FEATURE_POLICY_HEADER = "Feature-Policy"; - @Before + @BeforeEach public void setUp() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/HpkpHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/HpkpHeaderWriterTests.java index 362891a84d..0046f7838c 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/HpkpHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/HpkpHeaderWriterTests.java @@ -22,8 +22,8 @@ import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -54,7 +54,7 @@ public class HpkpHeaderWriterTests { private static final String HPKP_RO_HEADER_NAME = "Public-Key-Pins-Report-Only"; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/HstsHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/HstsHeaderWriterTests.java index 8b7ea413ef..3b98e903fa 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/HstsHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/HstsHeaderWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -41,7 +41,7 @@ public class HstsHeaderWriterTests { private static final String HSTS_HEADER_NAME = "Strict-Transport-Security"; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.request.setSecure(true); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/PermissionsPolicyHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/PermissionsPolicyHeaderWriterTests.java index 54a8a00437..e8176b6e92 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/PermissionsPolicyHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/PermissionsPolicyHeaderWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -42,7 +42,7 @@ public class PermissionsPolicyHeaderWriterTests { private static final String PERMISSIONS_POLICY_HEADER = "Permissions-Policy"; - @Before + @BeforeEach public void setUp() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/ReferrerPolicyHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/ReferrerPolicyHeaderWriterTests.java index 2d5f6a7b40..3ae5f6342c 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/ReferrerPolicyHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/ReferrerPolicyHeaderWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -42,7 +42,7 @@ public class ReferrerPolicyHeaderWriterTests { private static final String REFERRER_POLICY_HEADER = "Referrer-Policy"; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.request.setSecure(true); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/StaticHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/StaticHeaderWriterTests.java index 863e0f4f29..70f97e6c67 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/StaticHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/StaticHeaderWriterTests.java @@ -19,8 +19,8 @@ package org.springframework.security.web.header.writers; import java.util.Arrays; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -43,7 +43,7 @@ public class StaticHeaderWriterTests { private MockHttpServletResponse response; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/XContentTypeOptionsHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/XContentTypeOptionsHeaderWriterTests.java index fac153df1e..afb6feaf07 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/XContentTypeOptionsHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/XContentTypeOptionsHeaderWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -36,7 +36,7 @@ public class XContentTypeOptionsHeaderWriterTests { private XContentTypeOptionsHeaderWriter writer; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/XXssProtectionHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/XXssProtectionHeaderWriterTests.java index 3bbba80c85..d9c51ba770 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/XXssProtectionHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/XXssProtectionHeaderWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -40,7 +40,7 @@ public class XXssProtectionHeaderWriterTests { private static final String XSS_PROTECTION_HEADER = "X-XSS-Protection"; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/AbstractRequestParameterAllowFromStrategyTests.java b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/AbstractRequestParameterAllowFromStrategyTests.java index 10599ea34d..f03d98084a 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/AbstractRequestParameterAllowFromStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/AbstractRequestParameterAllowFromStrategyTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.header.writers.frameoptions; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; @@ -31,7 +31,7 @@ public class AbstractRequestParameterAllowFromStrategyTests { private MockHttpServletRequest request; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); } diff --git a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/FrameOptionsHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/FrameOptionsHeaderWriterTests.java index 3e3079df1a..f955ef4dcc 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/FrameOptionsHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/FrameOptionsHeaderWriterTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.header.writers.frameoptions; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -34,7 +34,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class FrameOptionsHeaderWriterTests { @Mock @@ -46,7 +46,7 @@ public class FrameOptionsHeaderWriterTests { private XFrameOptionsHeaderWriter writer; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.response = new MockHttpServletResponse(); diff --git a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/RegExpAllowFromStrategyTests.java b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/RegExpAllowFromStrategyTests.java index bfdc47fde4..d3717ff210 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/RegExpAllowFromStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/RegExpAllowFromStrategyTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.header.writers.frameoptions; import java.util.regex.PatternSyntaxException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/StaticAllowFromStrategyTests.java b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/StaticAllowFromStrategyTests.java index e5faa74757..f7d423dd83 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/StaticAllowFromStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/StaticAllowFromStrategyTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.header.writers.frameoptions; import java.net.URI; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/WhiteListedAllowFromStrategyTests.java b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/WhiteListedAllowFromStrategyTests.java index ca93c8d3b4..4b76742d8c 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/WhiteListedAllowFromStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/WhiteListedAllowFromStrategyTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.header.writers.frameoptions; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/XFrameOptionsHeaderWriterTests.java b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/XFrameOptionsHeaderWriterTests.java index d2974bc865..50f92e2413 100644 --- a/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/XFrameOptionsHeaderWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/header/writers/frameoptions/XFrameOptionsHeaderWriterTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.header.writers.frameoptions; import java.util.Arrays; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilterTests.java b/web/src/test/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilterTests.java index d8412b2e8c..f1709d3192 100644 --- a/web/src/test/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilterTests.java @@ -35,9 +35,9 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -72,7 +72,7 @@ public class JaasApiIntegrationFilterTests { private CallbackHandler callbackHandler; - @Before + @BeforeEach public void onBeforeTests() throws Exception { this.filter = new JaasApiIntegrationFilter(); this.request = new MockHttpServletRequest(); @@ -117,7 +117,7 @@ public class JaasApiIntegrationFilterTests { SecurityContextHolder.clearContext(); } - @After + @AfterEach public void onAfterTests() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/jackson2/AbstractMixinTests.java b/web/src/test/java/org/springframework/security/web/jackson2/AbstractMixinTests.java index 0b64b22bfb..29164c617e 100644 --- a/web/src/test/java/org/springframework/security/web/jackson2/AbstractMixinTests.java +++ b/web/src/test/java/org/springframework/security/web/jackson2/AbstractMixinTests.java @@ -17,7 +17,7 @@ package org.springframework.security.web.jackson2; import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.springframework.security.jackson2.SecurityJackson2Modules; @@ -29,7 +29,7 @@ public abstract class AbstractMixinTests { protected ObjectMapper mapper; - @Before + @BeforeEach public void setup() { this.mapper = new ObjectMapper(); ClassLoader loader = getClass().getClassLoader(); diff --git a/web/src/test/java/org/springframework/security/web/jackson2/CookieMixinTests.java b/web/src/test/java/org/springframework/security/web/jackson2/CookieMixinTests.java index 15c202283a..41bc753d3b 100644 --- a/web/src/test/java/org/springframework/security/web/jackson2/CookieMixinTests.java +++ b/web/src/test/java/org/springframework/security/web/jackson2/CookieMixinTests.java @@ -22,7 +22,7 @@ import javax.servlet.http.Cookie; import com.fasterxml.jackson.core.JsonProcessingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import static org.assertj.core.api.Assertions.assertThat; diff --git a/web/src/test/java/org/springframework/security/web/jackson2/DefaultCsrfTokenMixinTests.java b/web/src/test/java/org/springframework/security/web/jackson2/DefaultCsrfTokenMixinTests.java index d14dc83e3a..5a80c9ebe7 100644 --- a/web/src/test/java/org/springframework/security/web/jackson2/DefaultCsrfTokenMixinTests.java +++ b/web/src/test/java/org/springframework/security/web/jackson2/DefaultCsrfTokenMixinTests.java @@ -21,7 +21,7 @@ import java.io.IOException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.web.csrf.DefaultCsrfToken; diff --git a/web/src/test/java/org/springframework/security/web/jackson2/DefaultSavedRequestMixinTests.java b/web/src/test/java/org/springframework/security/web/jackson2/DefaultSavedRequestMixinTests.java index c289e87387..3ef5f37fec 100644 --- a/web/src/test/java/org/springframework/security/web/jackson2/DefaultSavedRequestMixinTests.java +++ b/web/src/test/java/org/springframework/security/web/jackson2/DefaultSavedRequestMixinTests.java @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenMixinTests.java b/web/src/test/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenMixinTests.java index 7be1a9514e..4cb597cc27 100644 --- a/web/src/test/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenMixinTests.java +++ b/web/src/test/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenMixinTests.java @@ -18,8 +18,8 @@ package org.springframework.security.web.jackson2; import com.fasterxml.jackson.core.JsonProcessingException; import org.json.JSONException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.core.authority.AuthorityUtils; @@ -46,7 +46,7 @@ public class PreAuthenticatedAuthenticationTokenMixinTests extends AbstractMixin // @formatter:on PreAuthenticatedAuthenticationToken expected; - @Before + @BeforeEach public void setupExpected() { this.expected = new PreAuthenticatedAuthenticationToken("principal", "credentials", AuthorityUtils.createAuthorityList("ROLE_USER")); diff --git a/web/src/test/java/org/springframework/security/web/jackson2/SavedCookieMixinTests.java b/web/src/test/java/org/springframework/security/web/jackson2/SavedCookieMixinTests.java index 8fc97e5db1..06f4bbfa9c 100644 --- a/web/src/test/java/org/springframework/security/web/jackson2/SavedCookieMixinTests.java +++ b/web/src/test/java/org/springframework/security/web/jackson2/SavedCookieMixinTests.java @@ -26,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.core.JsonProcessingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.web.savedrequest.SavedCookie; diff --git a/web/src/test/java/org/springframework/security/web/jackson2/WebAuthenticationDetailsMixinTests.java b/web/src/test/java/org/springframework/security/web/jackson2/WebAuthenticationDetailsMixinTests.java index 4b353a4cb8..8a3d2f7c43 100644 --- a/web/src/test/java/org/springframework/security/web/jackson2/WebAuthenticationDetailsMixinTests.java +++ b/web/src/test/java/org/springframework/security/web/jackson2/WebAuthenticationDetailsMixinTests.java @@ -20,7 +20,7 @@ import java.io.IOException; import com.fasterxml.jackson.core.JsonProcessingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/method/annotation/AuthenticationPrincipalArgumentResolverTests.java b/web/src/test/java/org/springframework/security/web/method/annotation/AuthenticationPrincipalArgumentResolverTests.java index a9bb9d009b..c995cdcda4 100644 --- a/web/src/test/java/org/springframework/security/web/method/annotation/AuthenticationPrincipalArgumentResolverTests.java +++ b/web/src/test/java/org/springframework/security/web/method/annotation/AuthenticationPrincipalArgumentResolverTests.java @@ -22,9 +22,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Method; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.MethodParameter; import org.springframework.expression.BeanResolver; @@ -56,14 +56,14 @@ public class AuthenticationPrincipalArgumentResolverTests { private AuthenticationPrincipalArgumentResolver resolver; - @Before + @BeforeEach public void setup() { this.beanResolver = mock(BeanResolver.class); this.resolver = new AuthenticationPrincipalArgumentResolver(); this.resolver.setBeanResolver(this.beanResolver); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/method/annotation/CsrfTokenArgumentResolverTests.java b/web/src/test/java/org/springframework/security/web/method/annotation/CsrfTokenArgumentResolverTests.java index 745902a800..7355531af8 100644 --- a/web/src/test/java/org/springframework/security/web/method/annotation/CsrfTokenArgumentResolverTests.java +++ b/web/src/test/java/org/springframework/security/web/method/annotation/CsrfTokenArgumentResolverTests.java @@ -18,11 +18,11 @@ package org.springframework.security.web.method.annotation; import java.lang.reflect.Method; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.MethodParameter; import org.springframework.mock.web.MockHttpServletRequest; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CsrfTokenArgumentResolverTests { @Mock @@ -57,7 +57,7 @@ public class CsrfTokenArgumentResolverTests { private CsrfTokenArgumentResolver resolver; - @Before + @BeforeEach public void setup() { this.token = new DefaultCsrfToken("X-CSRF-TOKEN", "_csrf", "secret"); this.resolver = new CsrfTokenArgumentResolver(); diff --git a/web/src/test/java/org/springframework/security/web/method/annotation/CurrentSecurityContextArgumentResolverTests.java b/web/src/test/java/org/springframework/security/web/method/annotation/CurrentSecurityContextArgumentResolverTests.java index 2a2a17178a..788b30ca97 100644 --- a/web/src/test/java/org/springframework/security/web/method/annotation/CurrentSecurityContextArgumentResolverTests.java +++ b/web/src/test/java/org/springframework/security/web/method/annotation/CurrentSecurityContextArgumentResolverTests.java @@ -22,9 +22,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Method; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.core.MethodParameter; import org.springframework.expression.BeanResolver; @@ -57,14 +57,14 @@ public class CurrentSecurityContextArgumentResolverTests { private CurrentSecurityContextArgumentResolver resolver; - @Before + @BeforeEach public void setup() { this.beanResolver = mock(BeanResolver.class); this.resolver = new CurrentSecurityContextArgumentResolver(); this.resolver.setBeanResolver(this.beanResolver); } - @After + @AfterEach public void cleanup() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolverTests.java b/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolverTests.java index ccbdb47b56..f86c3c6281 100644 --- a/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolverTests.java +++ b/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolverTests.java @@ -22,11 +22,11 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; @@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthenticationPrincipalArgumentResolverTests { @Mock @@ -74,7 +74,7 @@ public class AuthenticationPrincipalArgumentResolverTests { AuthenticationPrincipalArgumentResolver resolver; - @Before + @BeforeEach public void setup() { this.resolver = new AuthenticationPrincipalArgumentResolver(new ReactiveAdapterRegistry()); this.resolver.setBeanResolver(this.beanResolver); diff --git a/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/CurrentSecurityContextArgumentResolverTests.java b/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/CurrentSecurityContextArgumentResolverTests.java index f138550b42..3971a4fbee 100644 --- a/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/CurrentSecurityContextArgumentResolverTests.java +++ b/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/CurrentSecurityContextArgumentResolverTests.java @@ -21,11 +21,11 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.util.context.Context; @@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Dan Zheng * @since 5.2 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CurrentSecurityContextArgumentResolverTests { @Mock @@ -74,7 +74,7 @@ public class CurrentSecurityContextArgumentResolverTests { CurrentSecurityContextArgumentResolver resolver; - @Before + @BeforeEach public void setup() { this.resolver = new CurrentSecurityContextArgumentResolver(new ReactiveAdapterRegistry()); this.resolver.setBeanResolver(this.beanResolver); diff --git a/web/src/test/java/org/springframework/security/web/reactive/result/view/CsrfRequestDataValueProcessorTests.java b/web/src/test/java/org/springframework/security/web/reactive/result/view/CsrfRequestDataValueProcessorTests.java index 874b565652..d5e969812b 100644 --- a/web/src/test/java/org/springframework/security/web/reactive/result/view/CsrfRequestDataValueProcessorTests.java +++ b/web/src/test/java/org/springframework/security/web/reactive/result/view/CsrfRequestDataValueProcessorTests.java @@ -20,8 +20,8 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -46,7 +46,7 @@ public class CsrfRequestDataValueProcessorTests { private Map expected = new HashMap<>(); - @Before + @BeforeEach public void setup() { this.expected.put(this.token.getParameterName(), this.token.getToken()); this.exchange.getAttributes().put(CsrfRequestDataValueProcessor.DEFAULT_CSRF_ATTR_NAME, this.token); diff --git a/web/src/test/java/org/springframework/security/web/savedrequest/CookieRequestCacheTests.java b/web/src/test/java/org/springframework/security/web/savedrequest/CookieRequestCacheTests.java index c3bb91500c..320a273181 100644 --- a/web/src/test/java/org/springframework/security/web/savedrequest/CookieRequestCacheTests.java +++ b/web/src/test/java/org/springframework/security/web/savedrequest/CookieRequestCacheTests.java @@ -21,7 +21,7 @@ import java.util.Base64; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/savedrequest/DefaultSavedRequestTests.java b/web/src/test/java/org/springframework/security/web/savedrequest/DefaultSavedRequestTests.java index 258d7084ea..801e828f75 100644 --- a/web/src/test/java/org/springframework/security/web/savedrequest/DefaultSavedRequestTests.java +++ b/web/src/test/java/org/springframework/security/web/savedrequest/DefaultSavedRequestTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.savedrequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.MockPortResolver; diff --git a/web/src/test/java/org/springframework/security/web/savedrequest/HttpSessionRequestCacheTests.java b/web/src/test/java/org/springframework/security/web/savedrequest/HttpSessionRequestCacheTests.java index 83a9499f60..0560027114 100644 --- a/web/src/test/java/org/springframework/security/web/savedrequest/HttpSessionRequestCacheTests.java +++ b/web/src/test/java/org/springframework/security/web/savedrequest/HttpSessionRequestCacheTests.java @@ -25,7 +25,7 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; diff --git a/web/src/test/java/org/springframework/security/web/savedrequest/RequestCacheAwareFilterTests.java b/web/src/test/java/org/springframework/security/web/savedrequest/RequestCacheAwareFilterTests.java index 08414bf576..fc2184a504 100644 --- a/web/src/test/java/org/springframework/security/web/savedrequest/RequestCacheAwareFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/savedrequest/RequestCacheAwareFilterTests.java @@ -20,7 +20,7 @@ import java.util.Base64; import javax.servlet.http.Cookie; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/savedrequest/SavedCookieTests.java b/web/src/test/java/org/springframework/security/web/savedrequest/SavedCookieTests.java index 0bb9dd6027..1f7901b069 100644 --- a/web/src/test/java/org/springframework/security/web/savedrequest/SavedCookieTests.java +++ b/web/src/test/java/org/springframework/security/web/savedrequest/SavedCookieTests.java @@ -20,8 +20,8 @@ import java.io.Serializable; import javax.servlet.http.Cookie; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +31,7 @@ public class SavedCookieTests { SavedCookie savedCookie; - @Before + @BeforeEach public void setUp() { this.cookie = new Cookie("name", "value"); this.cookie.setComment("comment"); diff --git a/web/src/test/java/org/springframework/security/web/savedrequest/SavedRequestAwareWrapperTests.java b/web/src/test/java/org/springframework/security/web/savedrequest/SavedRequestAwareWrapperTests.java index 1463067b4e..4f53239f66 100644 --- a/web/src/test/java/org/springframework/security/web/savedrequest/SavedRequestAwareWrapperTests.java +++ b/web/src/test/java/org/springframework/security/web/savedrequest/SavedRequestAwareWrapperTests.java @@ -23,7 +23,7 @@ import java.util.Locale; import javax.servlet.http.Cookie; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.web.PortResolverImpl; diff --git a/web/src/test/java/org/springframework/security/web/savedrequest/SimpleSavedRequestTests.java b/web/src/test/java/org/springframework/security/web/savedrequest/SimpleSavedRequestTests.java index 45afe5fa6a..2484589ba1 100644 --- a/web/src/test/java/org/springframework/security/web/savedrequest/SimpleSavedRequestTests.java +++ b/web/src/test/java/org/springframework/security/web/savedrequest/SimpleSavedRequestTests.java @@ -24,7 +24,7 @@ import java.util.Map; import javax.servlet.http.Cookie; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; 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 9b6d03637e..73decc437f 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 @@ -18,10 +18,10 @@ package org.springframework.security.web.server; import java.net.URI; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpStatus; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -36,7 +36,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DefaultServerRedirectStrategyTests { @Mock 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 d80795a937..7f06021216 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 @@ -16,10 +16,10 @@ package org.springframework.security.web.server; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.http.HttpStatus; @@ -40,7 +40,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingServerAuthenticationEntryPointTests { private ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build()); diff --git a/web/src/test/java/org/springframework/security/web/server/ExchangeMatcherRedirectWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/ExchangeMatcherRedirectWebFilterTests.java index 323e56f96c..1bbdd962d4 100644 --- a/web/src/test/java/org/springframework/security/web/server/ExchangeMatcherRedirectWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/ExchangeMatcherRedirectWebFilterTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.server; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.security.web.server.util.matcher.PathPatternParserServerWebExchangeMatcher; diff --git a/web/src/test/java/org/springframework/security/web/server/WebFilterChainProxyTests.java b/web/src/test/java/org/springframework/security/web/server/WebFilterChainProxyTests.java index cb60a158bf..4f527b6850 100644 --- a/web/src/test/java/org/springframework/security/web/server/WebFilterChainProxyTests.java +++ b/web/src/test/java/org/springframework/security/web/server/WebFilterChainProxyTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.server; import java.util.Arrays; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.http.HttpStatus; diff --git a/web/src/test/java/org/springframework/security/web/server/WebFilterExchangeTests.java b/web/src/test/java/org/springframework/security/web/server/WebFilterExchangeTests.java index 7ee9c3a83d..ae1255d2e9 100644 --- a/web/src/test/java/org/springframework/security/web/server/WebFilterExchangeTests.java +++ b/web/src/test/java/org/springframework/security/web/server/WebFilterExchangeTests.java @@ -16,10 +16,10 @@ package org.springframework.security.web.server; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebFilterChain; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class WebFilterExchangeTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/AnonymousAuthenticationWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/AnonymousAuthenticationWebFilterTests.java index 7bbbcc9985..7fcd199c47 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/AnonymousAuthenticationWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/AnonymousAuthenticationWebFilterTests.java @@ -18,9 +18,9 @@ package org.springframework.security.web.server.authentication; import java.util.UUID; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.security.core.Authentication; @@ -37,7 +37,7 @@ import org.springframework.web.server.ServerWebExchange; * @author Ankur Pathak * @since 5.2.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AnonymousAuthenticationWebFilterTests { @Test diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationConverterServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationConverterServerWebExchangeMatcherTests.java index ee694ac81d..649bd4e6dc 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationConverterServerWebExchangeMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationConverterServerWebExchangeMatcherTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.server.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; * @author David Kovac * @since 5.4 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthenticationConverterServerWebExchangeMatcherTests { private MockServerWebExchange exchange; @@ -51,7 +51,7 @@ public class AuthenticationConverterServerWebExchangeMatcherTests { @Mock private ServerAuthenticationConverter converter; - @Before + @BeforeEach public void setup() { MockServerHttpRequest request = MockServerHttpRequest.get("/path").build(); this.exchange = MockServerWebExchange.from(request); 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 55986a3565..1d8271a847 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 @@ -16,11 +16,11 @@ package org.springframework.security.web.server.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.security.authentication.BadCredentialsException; @@ -49,7 +49,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rafiullah Hamedy * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthenticationWebFilterTests { @Mock @@ -72,7 +72,7 @@ public class AuthenticationWebFilterTests { private AuthenticationWebFilter filter; - @Before + @BeforeEach public void setup() { this.filter = new AuthenticationWebFilter(this.authenticationManager); this.filter.setAuthenticationSuccessHandler(this.successHandler); diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/DelegatingServerAuthenticationSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/DelegatingServerAuthenticationSuccessHandlerTests.java index 744289b5a9..3473394377 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/DelegatingServerAuthenticationSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/DelegatingServerAuthenticationSuccessHandlerTests.java @@ -21,11 +21,11 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.publisher.PublisherProbe; @@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingServerAuthenticationSuccessHandlerTests { @Mock @@ -60,7 +60,7 @@ public class DelegatingServerAuthenticationSuccessHandlerTests { @Mock private Authentication authentication; - @Before + @BeforeEach public void setup() { given(this.delegate1.onAuthenticationSuccess(any(), any())).willReturn(this.delegate1Result.mono()); given(this.delegate2.onAuthenticationSuccess(any(), any())).willReturn(this.delegate2Result.mono()); 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 5c93b43241..872e403b48 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 @@ -16,10 +16,10 @@ package org.springframework.security.web.server.authentication; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpStatus; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -36,7 +36,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class HttpBasicServerAuthenticationEntryPointTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/HttpStatusServerEntryPointTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/HttpStatusServerEntryPointTests.java index 4adcb4b705..f9122445fb 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/HttpStatusServerEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/HttpStatusServerEntryPointTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.server.authentication; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -41,7 +41,7 @@ public class HttpStatusServerEntryPointTests { private HttpStatusServerEntryPoint entryPoint; - @Before + @BeforeEach public void setup() { this.request = MockServerHttpRequest.get("/").build(); this.exchange = MockServerWebExchange.from(this.request); diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/ReactivePreAuthenticatedAuthenticationManagerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/ReactivePreAuthenticatedAuthenticationManagerTests.java index 8f4c001558..23d6ca10c9 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/ReactivePreAuthenticatedAuthenticationManagerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/ReactivePreAuthenticatedAuthenticationManagerTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.server.authentication; import java.util.Collections; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.security.authentication.AccountExpiredException; diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java index 8e46b77c62..14bc997eed 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java @@ -16,10 +16,10 @@ package org.springframework.security.web.server.authentication; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.test.publisher.PublisherProbe; import org.springframework.http.HttpStatus; @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class RedirectServerAuthenticationEntryPointTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationFailureHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationFailureHandlerTests.java index ba12f17c66..499cdb2e2d 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationFailureHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationFailureHandlerTests.java @@ -16,10 +16,10 @@ package org.springframework.security.web.server.authentication; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.publisher.PublisherProbe; @@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class RedirectServerAuthenticationFailureHandlerTests { private WebFilterExchange exchange; diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java index 7178642c56..5d10a01e74 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java @@ -18,10 +18,10 @@ package org.springframework.security.web.server.authentication; import java.net.URI; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.test.publisher.PublisherProbe; import org.springframework.http.HttpStatus; @@ -44,7 +44,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class RedirectServerAuthenticationSuccessHandlerTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandlerTests.java index 45b4fa5b62..1ee69267a0 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandlerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.server.authentication; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.security.authentication.BadCredentialsException; @@ -37,7 +37,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServerAuthenticationEntryPointFailureHandlerTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/ServerFormLoginAuthenticationConverterTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/ServerFormLoginAuthenticationConverterTests.java index 2d9b33ac18..16544a9d05 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/ServerFormLoginAuthenticationConverterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/ServerFormLoginAuthenticationConverterTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.server.authentication; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.security.core.Authentication; @@ -36,7 +36,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServerFormLoginAuthenticationConverterTests { @Mock @@ -46,7 +46,7 @@ public class ServerFormLoginAuthenticationConverterTests { private ServerFormLoginAuthenticationConverter converter = new ServerFormLoginAuthenticationConverter(); - @Before + @BeforeEach public void setup() { given(this.exchange.getFormData()).willReturn(Mono.just(this.data)); } diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/ServerHttpBasicAuthenticationConverterTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/ServerHttpBasicAuthenticationConverterTests.java index b00b308031..1f4a0d2a3f 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/ServerHttpBasicAuthenticationConverterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/ServerHttpBasicAuthenticationConverterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.authentication; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.http.HttpHeaders; diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/ServerX509AuthenticationConverterTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/ServerX509AuthenticationConverterTests.java index f94d6aeb33..e2f1073244 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/ServerX509AuthenticationConverterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/ServerX509AuthenticationConverterTests.java @@ -18,12 +18,12 @@ package org.springframework.security.web.server.authentication; import java.security.cert.X509Certificate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.server.reactive.SslInfo; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServerX509AuthenticationConverterTests { @Mock @@ -49,7 +49,7 @@ public class ServerX509AuthenticationConverterTests { private MockServerHttpRequest.BaseBuilder request; - @Before + @BeforeEach public void setUp() throws Exception { this.request = MockServerHttpRequest.get("/"); this.certificate = X509TestUtils.buildTestCertificate(); diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/SwitchUserWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/SwitchUserWebFilterTests.java index 898d543c2c..527d90345d 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/SwitchUserWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/SwitchUserWebFilterTests.java @@ -19,12 +19,12 @@ package org.springframework.security.web.server.authentication; import java.security.Principal; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.util.context.Context; @@ -66,7 +66,7 @@ import static org.mockito.Mockito.verifyNoInteractions; /** * @author Artur Otrzonsek */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SwitchUserWebFilterTests { private SwitchUserWebFilter switchUserWebFilter; @@ -83,7 +83,7 @@ public class SwitchUserWebFilterTests { @Mock private ServerSecurityContextRepository serverSecurityContextRepository; - @Before + @BeforeEach public void setUp() { this.switchUserWebFilter = new SwitchUserWebFilter(this.userDetailsService, this.successHandler, this.failureHandler); diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/logout/DelegatingServerLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/logout/DelegatingServerLogoutHandlerTests.java index 81a0d2f1fe..eda78ec76e 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/logout/DelegatingServerLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/logout/DelegatingServerLogoutHandlerTests.java @@ -22,11 +22,11 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.publisher.PublisherProbe; @@ -42,7 +42,7 @@ import static org.mockito.BDDMockito.given; * @author Eric Deandrea * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class DelegatingServerLogoutHandlerTests { @Mock @@ -61,7 +61,7 @@ public class DelegatingServerLogoutHandlerTests { @Mock private Authentication authentication; - @Before + @BeforeEach public void setup() { given(this.delegate1.logout(any(WebFilterExchange.class), any(Authentication.class))) .willReturn(this.delegate1Result.mono()); diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/logout/HeaderWriterServerLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/logout/HeaderWriterServerLogoutHandlerTests.java index af8cad8e6b..a8c86d6e0a 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/logout/HeaderWriterServerLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/logout/HeaderWriterServerLogoutHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.authentication.logout; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.core.Authentication; import org.springframework.security.web.server.WebFilterExchange; diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/logout/HttpStatusReturningServerLogoutSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/logout/HttpStatusReturningServerLogoutSuccessHandlerTests.java index d26a9b345f..e64002ca9e 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/logout/HttpStatusReturningServerLogoutSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/logout/HttpStatusReturningServerLogoutSuccessHandlerTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.authentication.logout; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilterTests.java index d87fdeb9fb..13517a61a6 100644 --- a/web/src/test/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilterTests.java @@ -20,10 +20,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.stream.Collectors; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.test.util.ReflectionTestUtils; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Eric Deandrea * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class LogoutWebFilterTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/server/authorization/AuthorizationWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/authorization/AuthorizationWebFilterTests.java index 0afc768ed2..8d348cba16 100644 --- a/web/src/test/java/org/springframework/security/web/server/authorization/AuthorizationWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authorization/AuthorizationWebFilterTests.java @@ -16,10 +16,10 @@ package org.springframework.security.web.server.authorization; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import reactor.test.publisher.PublisherProbe; @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AuthorizationWebFilterTests { @Mock 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 ae9e0bbc8f..c14c391ab9 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 @@ -16,8 +16,8 @@ package org.springframework.security.web.server.authorization; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import reactor.core.publisher.Mono; @@ -65,7 +65,7 @@ public class DelegatingReactiveAuthorizationManagerTests { DelegatingReactiveAuthorizationManager manager; - @Before + @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); this.manager = DelegatingReactiveAuthorizationManager.builder() diff --git a/web/src/test/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilterTests.java index b9ab463880..f258c4569c 100644 --- a/web/src/test/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilterTests.java @@ -18,11 +18,11 @@ package org.springframework.security.web.server.authorization; import java.security.Principal; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import reactor.test.publisher.PublisherProbe; @@ -45,7 +45,7 @@ import static org.mockito.BDDMockito.given; * @author César Revert * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ExceptionTranslationWebFilterTests { @Mock @@ -72,7 +72,7 @@ public class ExceptionTranslationWebFilterTests { private ExceptionTranslationWebFilter filter = new ExceptionTranslationWebFilter(); - @Before + @BeforeEach public void setup() { given(this.exchange.getResponse()).willReturn(new MockServerHttpResponse()); given(this.deniedHandler.handle(any(), any())).willReturn(this.deniedPublisher.mono()); 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 ade1054efa..a539cc64bf 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 @@ -16,10 +16,10 @@ package org.springframework.security.web.server.authorization; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpStatus; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -35,7 +35,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class HttpStatusServerAccessDeniedHandlerTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/server/authorization/ServerWebExchangeDelegatingServerAccessDeniedHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authorization/ServerWebExchangeDelegatingServerAccessDeniedHandlerTests.java index 896f8d20f3..c9ec4c543d 100644 --- a/web/src/test/java/org/springframework/security/web/server/authorization/ServerWebExchangeDelegatingServerAccessDeniedHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/authorization/ServerWebExchangeDelegatingServerAccessDeniedHandlerTests.java @@ -19,8 +19,8 @@ package org.springframework.security.web.server.authorization; import java.util.ArrayList; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.security.web.server.authorization.ServerWebExchangeDelegatingServerAccessDeniedHandler.DelegateEntry; @@ -43,7 +43,7 @@ public class ServerWebExchangeDelegatingServerAccessDeniedHandlerTests { private ServerWebExchange exchange; - @Before + @BeforeEach public void setup() { this.accessDeniedHandler = mock(ServerAccessDeniedHandler.class); this.entries = new ArrayList<>(); diff --git a/web/src/test/java/org/springframework/security/web/server/context/NoOpServerSecurityContextRepositoryTests.java b/web/src/test/java/org/springframework/security/web/server/context/NoOpServerSecurityContextRepositoryTests.java index fd2c7c08d9..5f3971292e 100644 --- a/web/src/test/java/org/springframework/security/web/server/context/NoOpServerSecurityContextRepositoryTests.java +++ b/web/src/test/java/org/springframework/security/web/server/context/NoOpServerSecurityContextRepositoryTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.context; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; diff --git a/web/src/test/java/org/springframework/security/web/server/context/ReactorContextWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/context/ReactorContextWebFilterTests.java index b03bcc4705..e730f5928b 100644 --- a/web/src/test/java/org/springframework/security/web/server/context/ReactorContextWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/context/ReactorContextWebFilterTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.server.context; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import reactor.test.publisher.TestPublisher; @@ -46,7 +46,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ReactorContextWebFilterTests { @Mock @@ -63,7 +63,7 @@ public class ReactorContextWebFilterTests { private WebTestHandler handler; - @Before + @BeforeEach public void setup() { this.filter = new ReactorContextWebFilter(this.repository); this.handler = WebTestHandler.bindToWebFilters(this.filter); diff --git a/web/src/test/java/org/springframework/security/web/server/context/SecurityContextServerWebExchangeWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/context/SecurityContextServerWebExchangeWebFilterTests.java index e6cdb78402..bcf3d2bba4 100644 --- a/web/src/test/java/org/springframework/security/web/server/context/SecurityContextServerWebExchangeWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/context/SecurityContextServerWebExchangeWebFilterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.context; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; diff --git a/web/src/test/java/org/springframework/security/web/server/context/WebSessionServerSecurityContextRepositoryTests.java b/web/src/test/java/org/springframework/security/web/server/context/WebSessionServerSecurityContextRepositoryTests.java index 4d5dc45ac0..f4af6f74f2 100644 --- a/web/src/test/java/org/springframework/security/web/server/context/WebSessionServerSecurityContextRepositoryTests.java +++ b/web/src/test/java/org/springframework/security/web/server/context/WebSessionServerSecurityContextRepositoryTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.context; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.web.server.MockServerWebExchange; diff --git a/web/src/test/java/org/springframework/security/web/server/csrf/CookieServerCsrfTokenRepositoryTests.java b/web/src/test/java/org/springframework/security/web/server/csrf/CookieServerCsrfTokenRepositoryTests.java index 7160337053..a1711dc201 100644 --- a/web/src/test/java/org/springframework/security/web/server/csrf/CookieServerCsrfTokenRepositoryTests.java +++ b/web/src/test/java/org/springframework/security/web/server/csrf/CookieServerCsrfTokenRepositoryTests.java @@ -19,8 +19,8 @@ package org.springframework.security.web.server.csrf; import java.security.cert.X509Certificate; import java.time.Duration; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpCookie; import org.springframework.http.ResponseCookie; @@ -60,7 +60,7 @@ public class CookieServerCsrfTokenRepositoryTests { private String expectedCookieValue = "csrfToken"; - @Before + @BeforeEach public void setUp() { this.csrfTokenRepository = new CookieServerCsrfTokenRepository(); this.request = MockServerHttpRequest.get("/someUri"); diff --git a/web/src/test/java/org/springframework/security/web/server/csrf/CsrfServerLogoutHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/csrf/CsrfServerLogoutHandlerTests.java index 60ced8c233..2fdfc91961 100644 --- a/web/src/test/java/org/springframework/security/web/server/csrf/CsrfServerLogoutHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/server/csrf/CsrfServerLogoutHandlerTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.server.csrf; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -37,7 +37,7 @@ import static org.mockito.Mockito.verify; * @author Eric Deandrea * @since 5.1 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CsrfServerLogoutHandlerTests { @Mock @@ -52,7 +52,7 @@ public class CsrfServerLogoutHandlerTests { private CsrfServerLogoutHandler handler; - @Before + @BeforeEach public void setup() { this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build()); this.filterExchange = new WebFilterExchange(this.exchange, this.filterChain); 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 591e91aa07..e31c239219 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 @@ -16,10 +16,10 @@ package org.springframework.security.web.server.csrf; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import reactor.test.publisher.PublisherProbe; @@ -48,7 +48,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Parikshit Dutta * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CsrfWebFilterTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepositoryTests.java b/web/src/test/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepositoryTests.java index 97adcbaece..e1124c0805 100644 --- a/web/src/test/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepositoryTests.java +++ b/web/src/test/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepositoryTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.server.csrf; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; diff --git a/web/src/test/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriterTests.java index 6ff6384f58..b346353349 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.header; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/web/src/test/java/org/springframework/security/web/server/header/ClearSiteDataServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/ClearSiteDataServerHttpHeadersWriterTests.java index fb2a9ec540..e8d17f4b1d 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/ClearSiteDataServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/ClearSiteDataServerHttpHeadersWriterTests.java @@ -21,7 +21,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.assertj.core.api.AbstractAssert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriterTests.java index c400c13a21..865a542aaf 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriterTests.java @@ -22,11 +22,11 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -42,7 +42,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class CompositeServerHttpHeadersWriterTests { @Mock @@ -55,7 +55,7 @@ public class CompositeServerHttpHeadersWriterTests { ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build()); - @Before + @BeforeEach public void setup() { this.writer = new CompositeServerHttpHeadersWriter(Arrays.asList(this.writer1, this.writer2)); } diff --git a/web/src/test/java/org/springframework/security/web/server/header/ContentSecurityPolicyServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/ContentSecurityPolicyServerHttpHeadersWriterTests.java index bc4a007c6b..1946cc57d1 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/ContentSecurityPolicyServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/ContentSecurityPolicyServerHttpHeadersWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.server.header; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -39,7 +39,7 @@ public class ContentSecurityPolicyServerHttpHeadersWriterTests { private ContentSecurityPolicyServerHttpHeadersWriter writer; - @Before + @BeforeEach public void setup() { this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")); this.writer = new ContentSecurityPolicyServerHttpHeadersWriter(); diff --git a/web/src/test/java/org/springframework/security/web/server/header/FeaturePolicyServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/FeaturePolicyServerHttpHeadersWriterTests.java index a0fd03f3ce..447c90f789 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/FeaturePolicyServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/FeaturePolicyServerHttpHeadersWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.server.header; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -39,7 +39,7 @@ public class FeaturePolicyServerHttpHeadersWriterTests { private FeaturePolicyServerHttpHeadersWriter writer; - @Before + @BeforeEach public void setup() { this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")); this.writer = new FeaturePolicyServerHttpHeadersWriter(); diff --git a/web/src/test/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilterTests.java index b953e78c2f..4275b536a8 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilterTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.server.header; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -38,7 +38,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class HttpHeaderWriterWebFilterTests { @Mock @@ -46,7 +46,7 @@ public class HttpHeaderWriterWebFilterTests { HttpHeaderWriterWebFilter filter; - @Before + @BeforeEach public void setup() { given(this.writer.writeHttpHeaders(any())).willReturn(Mono.empty()); this.filter = new HttpHeaderWriterWebFilter(this.writer); diff --git a/web/src/test/java/org/springframework/security/web/server/header/PermissionsPolicyServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/PermissionsPolicyServerHttpHeadersWriterTests.java index 7f28500eeb..4d8fc3d235 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/PermissionsPolicyServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/PermissionsPolicyServerHttpHeadersWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.server.header; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -39,7 +39,7 @@ public class PermissionsPolicyServerHttpHeadersWriterTests { private PermissionsPolicyServerHttpHeadersWriter writer; - @Before + @BeforeEach public void setup() { this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")); this.writer = new PermissionsPolicyServerHttpHeadersWriter(); diff --git a/web/src/test/java/org/springframework/security/web/server/header/ReferrerPolicyServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/ReferrerPolicyServerHttpHeadersWriterTests.java index 8502d1192a..75a7aa5e1e 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/ReferrerPolicyServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/ReferrerPolicyServerHttpHeadersWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.server.header; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -38,7 +38,7 @@ public class ReferrerPolicyServerHttpHeadersWriterTests { private ReferrerPolicyServerHttpHeadersWriter writer; - @Before + @BeforeEach public void setup() { this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/")); this.writer = new ReferrerPolicyServerHttpHeadersWriter(); diff --git a/web/src/test/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriterTests.java index 86809627fc..e411ee745b 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.header; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriterTests.java index 6f61d730d7..02ed96d3e7 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriterTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.server.header; import java.time.Duration; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriterTests.java index 15dcbd9892..a48583ddc3 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.header; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriterTests.java index 48e50ebae8..98ee2e5300 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriterTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.server.header; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -36,7 +36,7 @@ public class XFrameOptionsServerHttpHeadersWriterTests { XFrameOptionsServerHttpHeadersWriter writer; - @Before + @BeforeEach public void setup() { this.writer = new XFrameOptionsServerHttpHeadersWriter(); } diff --git a/web/src/test/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriterTests.java index f29a3397d7..ca789c5a2e 100644 --- a/web/src/test/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.header; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/jackson2/DefaultCsrfServerTokenMixinTests.java b/web/src/test/java/org/springframework/security/web/server/jackson2/DefaultCsrfServerTokenMixinTests.java index 54c3e41275..7626e1afb2 100644 --- a/web/src/test/java/org/springframework/security/web/server/jackson2/DefaultCsrfServerTokenMixinTests.java +++ b/web/src/test/java/org/springframework/security/web/server/jackson2/DefaultCsrfServerTokenMixinTests.java @@ -21,7 +21,7 @@ import java.io.IOException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import org.json.JSONException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.security.web.jackson2.AbstractMixinTests; diff --git a/web/src/test/java/org/springframework/security/web/server/savedrequest/CookieServerRequestCacheTests.java b/web/src/test/java/org/springframework/security/web/server/savedrequest/CookieServerRequestCacheTests.java index a80359be8e..eded2e5a9b 100644 --- a/web/src/test/java/org/springframework/security/web/server/savedrequest/CookieServerRequestCacheTests.java +++ b/web/src/test/java/org/springframework/security/web/server/savedrequest/CookieServerRequestCacheTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.server.savedrequest; import java.net.URI; import java.util.Base64; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpCookie; import org.springframework.http.MediaType; diff --git a/web/src/test/java/org/springframework/security/web/server/savedrequest/ServerRequestCacheWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/savedrequest/ServerRequestCacheWebFilterTests.java index 82224c5432..611bb3da1b 100644 --- a/web/src/test/java/org/springframework/security/web/server/savedrequest/ServerRequestCacheWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/savedrequest/ServerRequestCacheWebFilterTests.java @@ -16,13 +16,13 @@ package org.springframework.security.web.server.savedrequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.http.HttpHeaders; @@ -43,7 +43,7 @@ import static org.mockito.Mockito.verify; * * @author Eleftheria Stein */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ServerRequestCacheWebFilterTests { private ServerRequestCacheWebFilter requestCacheFilter; @@ -57,7 +57,7 @@ public class ServerRequestCacheWebFilterTests { @Captor private ArgumentCaptor exchangeCaptor; - @Before + @BeforeEach public void setup() { this.requestCacheFilter = new ServerRequestCacheWebFilter(); this.requestCacheFilter.setRequestCache(this.requestCache); diff --git a/web/src/test/java/org/springframework/security/web/server/savedrequest/WebSessionServerRequestCacheTests.java b/web/src/test/java/org/springframework/security/web/server/savedrequest/WebSessionServerRequestCacheTests.java index 35b2a95082..020ce2a0c8 100644 --- a/web/src/test/java/org/springframework/security/web/server/savedrequest/WebSessionServerRequestCacheTests.java +++ b/web/src/test/java/org/springframework/security/web/server/savedrequest/WebSessionServerRequestCacheTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.server.savedrequest; import java.net.URI; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; import org.springframework.http.server.reactive.ServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/transport/HttpsRedirectWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/transport/HttpsRedirectWebFilterTests.java index e7d0617268..d06a330bbf 100644 --- a/web/src/test/java/org/springframework/security/web/server/transport/HttpsRedirectWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/transport/HttpsRedirectWebFilterTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.server.transport; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import reactor.core.publisher.Mono; import org.springframework.http.HttpHeaders; @@ -44,7 +44,7 @@ import static org.mockito.Mockito.verify; * * @author Josh Cummings */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class HttpsRedirectWebFilterTests { HttpsRedirectWebFilter filter; @@ -52,7 +52,7 @@ public class HttpsRedirectWebFilterTests { @Mock WebFilterChain chain; - @Before + @BeforeEach public void configureFilter() { this.filter = new HttpsRedirectWebFilter(); given(this.chain.filter(any(ServerWebExchange.class))).willReturn(Mono.empty()); diff --git a/web/src/test/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilterTests.java index ccade95ad8..13932fd488 100644 --- a/web/src/test/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilterTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.server.ui; -import org.junit.Test; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcherTests.java index ab34e4928c..2bebbf6e02 100644 --- a/web/src/test/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcherTests.java @@ -19,11 +19,11 @@ package org.springframework.security.web.server.util.matcher; import java.util.Collections; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.web.server.ServerWebExchange; @@ -36,7 +36,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AndServerWebExchangeMatcherTests { @Mock @@ -50,7 +50,7 @@ public class AndServerWebExchangeMatcherTests { AndServerWebExchangeMatcher matcher; - @Before + @BeforeEach public void setUp() { this.matcher = new AndServerWebExchangeMatcher(this.matcher1, this.matcher2); } diff --git a/web/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java index 3b651accce..d7c2d9d77d 100644 --- a/web/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.server.util.matcher; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/server/util/matcher/NegatedServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/NegatedServerWebExchangeMatcherTests.java index 8636ed1b1d..aea329dfcf 100644 --- a/web/src/test/java/org/springframework/security/web/server/util/matcher/NegatedServerWebExchangeMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/server/util/matcher/NegatedServerWebExchangeMatcherTests.java @@ -16,11 +16,11 @@ package org.springframework.security.web.server.util.matcher; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.web.server.ServerWebExchange; @@ -32,7 +32,7 @@ import static org.mockito.Mockito.verify; * @author Tao Qian * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class NegatedServerWebExchangeMatcherTests { @Mock @@ -43,7 +43,7 @@ public class NegatedServerWebExchangeMatcherTests { NegatedServerWebExchangeMatcher matcher; - @Before + @BeforeEach public void setUp() { this.matcher = new NegatedServerWebExchangeMatcher(this.matcher1); } diff --git a/web/src/test/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcherTests.java index ee9b08d81c..3a71f18f7b 100644 --- a/web/src/test/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcherTests.java @@ -19,11 +19,11 @@ package org.springframework.security.web.server.util.matcher; import java.util.Collections; import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.web.server.ServerWebExchange; @@ -36,7 +36,7 @@ import static org.mockito.Mockito.verify; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OrServerWebExchangeMatcherTests { @Mock @@ -50,7 +50,7 @@ public class OrServerWebExchangeMatcherTests { OrServerWebExchangeMatcher matcher; - @Before + @BeforeEach public void setUp() { this.matcher = new OrServerWebExchangeMatcher(this.matcher1, this.matcher2); } 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 517919ec01..87a4369d79 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 @@ -18,11 +18,11 @@ package org.springframework.security.web.server.util.matcher; import java.util.HashMap; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpMethod; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -41,7 +41,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class PathMatcherServerWebExchangeMatcherTests { @Mock @@ -56,7 +56,7 @@ public class PathMatcherServerWebExchangeMatcherTests { String path; - @Before + @BeforeEach public void setup() { MockServerHttpRequest request = MockServerHttpRequest.post("/path").build(); MockServerHttpResponse response = new MockServerHttpResponse(); 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 62ceb878c2..e37a4052ad 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 @@ -16,7 +16,7 @@ package org.springframework.security.web.server.util.matcher; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; diff --git a/web/src/test/java/org/springframework/security/web/servlet/support/csrf/CsrfRequestDataValueProcessorTests.java b/web/src/test/java/org/springframework/security/web/servlet/support/csrf/CsrfRequestDataValueProcessorTests.java index 4e97fec869..b01a5cf6db 100644 --- a/web/src/test/java/org/springframework/security/web/servlet/support/csrf/CsrfRequestDataValueProcessorTests.java +++ b/web/src/test/java/org/springframework/security/web/servlet/support/csrf/CsrfRequestDataValueProcessorTests.java @@ -20,8 +20,8 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.web.csrf.CsrfToken; @@ -45,7 +45,7 @@ public class CsrfRequestDataValueProcessorTests { private Map expected = new HashMap<>(); - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.processor = new CsrfRequestDataValueProcessor(); 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 0019957058..414f343a2e 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 @@ -18,13 +18,13 @@ package org.springframework.security.web.servlet.util.matcher; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpMethod; import org.springframework.mock.web.MockHttpServletRequest; @@ -43,7 +43,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Eddú Meléndez * @author Evgeniy Cheban */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MvcRequestMatcherTests { @Mock @@ -62,7 +62,7 @@ public class MvcRequestMatcherTests { MvcRequestMatcher matcher; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); this.request.setMethod("GET"); 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 738ca5aecd..5e81db0a10 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 @@ -25,14 +25,14 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -67,7 +67,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; * @author Rob Winch * @author Eddú Meléndez */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class SecurityContextHolderAwareRequestFilterTests { @Captor @@ -95,7 +95,7 @@ public class SecurityContextHolderAwareRequestFilterTests { private SecurityContextHolderAwareRequestFilter filter; - @Before + @BeforeEach public void setUp() throws Exception { this.logoutHandlers = Arrays.asList(this.logoutHandler); this.filter = new SecurityContextHolderAwareRequestFilter(); @@ -105,7 +105,7 @@ public class SecurityContextHolderAwareRequestFilterTests { this.filter.afterPropertiesSet(); } - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestWrapperTests.java b/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestWrapperTests.java index ad262f2f24..7a0877844b 100644 --- a/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestWrapperTests.java +++ b/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestWrapperTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.servletapi; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.authentication.TestingAuthenticationToken; @@ -40,7 +40,7 @@ import static org.mockito.Mockito.verify; */ public class SecurityContextHolderAwareRequestWrapperTests { - @Before + @BeforeEach public void tearDown() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/session/DefaultSessionAuthenticationStrategyTests.java b/web/src/test/java/org/springframework/security/web/session/DefaultSessionAuthenticationStrategyTests.java index 558fdce2c5..58f651411a 100644 --- a/web/src/test/java/org/springframework/security/web/session/DefaultSessionAuthenticationStrategyTests.java +++ b/web/src/test/java/org/springframework/security/web/session/DefaultSessionAuthenticationStrategyTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.session; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.context.ApplicationEvent; diff --git a/web/src/test/java/org/springframework/security/web/session/HttpSessionDestroyedEventTests.java b/web/src/test/java/org/springframework/security/web/session/HttpSessionDestroyedEventTests.java index 71e11b6b06..3533606c44 100644 --- a/web/src/test/java/org/springframework/security/web/session/HttpSessionDestroyedEventTests.java +++ b/web/src/test/java/org/springframework/security/web/session/HttpSessionDestroyedEventTests.java @@ -18,8 +18,8 @@ package org.springframework.security.web.session; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpSession; import org.springframework.security.core.context.SecurityContext; @@ -38,7 +38,7 @@ public class HttpSessionDestroyedEventTests { private HttpSessionDestroyedEvent destroyedEvent; - @Before + @BeforeEach public void setUp() { this.session = new MockHttpSession(); this.session.setAttribute("notcontext", "notcontext"); diff --git a/web/src/test/java/org/springframework/security/web/session/HttpSessionEventPublisherTests.java b/web/src/test/java/org/springframework/security/web/session/HttpSessionEventPublisherTests.java index effa61b207..7bdbfc7a7d 100644 --- a/web/src/test/java/org/springframework/security/web/session/HttpSessionEventPublisherTests.java +++ b/web/src/test/java/org/springframework/security/web/session/HttpSessionEventPublisherTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.session; import javax.servlet.http.HttpSessionEvent; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpSession; import org.springframework.mock.web.MockServletContext; diff --git a/web/src/test/java/org/springframework/security/web/session/SessionInformationExpiredEventTests.java b/web/src/test/java/org/springframework/security/web/session/SessionInformationExpiredEventTests.java index 0ec42fcff4..352d6fd906 100644 --- a/web/src/test/java/org/springframework/security/web/session/SessionInformationExpiredEventTests.java +++ b/web/src/test/java/org/springframework/security/web/session/SessionInformationExpiredEventTests.java @@ -18,7 +18,7 @@ package org.springframework.security.web.session; import java.util.Date; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; 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 54802e3c07..b76367aa38 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 @@ -20,8 +20,8 @@ import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockHttpServletRequest; @@ -51,7 +51,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; */ public class SessionManagementFilterTests { - @After + @AfterEach public void clearContext() { SecurityContextHolder.clearContext(); } diff --git a/web/src/test/java/org/springframework/security/web/util/OnCommittedResponseWrapperTests.java b/web/src/test/java/org/springframework/security/web/util/OnCommittedResponseWrapperTests.java index e234ca1bb3..9b7dac899d 100644 --- a/web/src/test/java/org/springframework/security/web/util/OnCommittedResponseWrapperTests.java +++ b/web/src/test/java/org/springframework/security/web/util/OnCommittedResponseWrapperTests.java @@ -23,17 +23,17 @@ import java.util.Locale; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OnCommittedResponseWrapperTests { private static final String NL = "\r\n"; @@ -51,7 +51,7 @@ public class OnCommittedResponseWrapperTests { boolean committed; - @Before + @BeforeEach public void setup() throws Exception { this.response = new OnCommittedResponseWrapper(this.delegate) { @Override diff --git a/web/src/test/java/org/springframework/security/web/util/TextEscapeUtilsTests.java b/web/src/test/java/org/springframework/security/web/util/TextEscapeUtilsTests.java index b5d045b4ca..6ad525eb7b 100644 --- a/web/src/test/java/org/springframework/security/web/util/TextEscapeUtilsTests.java +++ b/web/src/test/java/org/springframework/security/web/util/TextEscapeUtilsTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -57,12 +57,12 @@ public class TextEscapeUtilsTests { */ @Test public void validSurrogatePairIsAccepted() { - assertThat(TextEscapeUtils.escapeEntities("abc\uD801\uDC00a")).isEqualTo("abc𐐀a"); + assertThat(TextEscapeUtils.escapeEntities("abc\uD801a")).isEqualTo("abc𐐀a"); } @Test public void undefinedSurrogatePairIsIgnored() { - assertThat(TextEscapeUtils.escapeEntities("abc\uD888\uDC00a")).isEqualTo("abca"); + assertThat(TextEscapeUtils.escapeEntities("abc\uD888a")).isEqualTo("abca"); } } diff --git a/web/src/test/java/org/springframework/security/web/util/ThrowableAnalyzerTests.java b/web/src/test/java/org/springframework/security/web/util/ThrowableAnalyzerTests.java index 7928e7203c..4714930e0f 100644 --- a/web/src/test/java/org/springframework/security/web/util/ThrowableAnalyzerTests.java +++ b/web/src/test/java/org/springframework/security/web/util/ThrowableAnalyzerTests.java @@ -18,8 +18,8 @@ package org.springframework.security.web.util; import java.lang.reflect.InvocationTargetException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -49,7 +49,7 @@ public class ThrowableAnalyzerTests { */ private ThrowableAnalyzer nonstandardAnalyzer; - @Before + @BeforeEach public void setUp() { // Set up test trace this.testTrace = new Throwable[7]; diff --git a/web/src/test/java/org/springframework/security/web/util/UrlUtilsTests.java b/web/src/test/java/org/springframework/security/web/util/UrlUtilsTests.java index 3130aec2a6..54ffb989ba 100644 --- a/web/src/test/java/org/springframework/security/web/util/UrlUtilsTests.java +++ b/web/src/test/java/org/springframework/security/web/util/UrlUtilsTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/AndRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/AndRequestMatcherTests.java index 08a2f851d1..a53e569c18 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/AndRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/AndRequestMatcherTests.java @@ -22,10 +22,10 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -36,7 +36,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AndRequestMatcherTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/AntPathRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/AntPathRequestMatcherTests.java index 1738b2a82b..5046947890 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/AntPathRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/AntPathRequestMatcherTests.java @@ -18,10 +18,10 @@ package org.springframework.security.web.util.matcher; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.web.util.UrlPathHelper; @@ -34,7 +34,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @author Evgeniy Cheban */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class AntPathRequestMatcherTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/DispatcherTypeRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/DispatcherTypeRequestMatcherTests.java index d8a7be6ee3..509912d50d 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/DispatcherTypeRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/DispatcherTypeRequestMatcherTests.java @@ -19,7 +19,7 @@ package org.springframework.security.web.util.matcher; import javax.servlet.DispatcherType; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/ELRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/ELRequestMatcherTests.java index d445c5c510..11719b8d87 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/ELRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/ELRequestMatcherTests.java @@ -16,7 +16,7 @@ package org.springframework.security.web.util.matcher; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/IpAddressMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/IpAddressMatcherTests.java index 281661e02c..1000f31853 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/IpAddressMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/IpAddressMatcherTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.util.matcher; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; @@ -37,7 +37,7 @@ public class IpAddressMatcherTests { MockHttpServletRequest ipv6Request = new MockHttpServletRequest(); - @Before + @BeforeEach public void setup() { this.ipv6Request.setRemoteAddr("fe80::21f:5bff:fe33:bd68"); this.ipv4Request.setRemoteAddr("192.168.1.104"); diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherRequestHCNSTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherRequestHCNSTests.java index 39b210cb76..dd664894a4 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherRequestHCNSTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherRequestHCNSTests.java @@ -18,8 +18,8 @@ package org.springframework.security.web.util.matcher; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.http.MediaType; import org.springframework.mock.web.MockHttpServletRequest; @@ -42,7 +42,7 @@ public class MediaTypeRequestMatcherRequestHCNSTests { private ContentNegotiationStrategy negotiationStrategy; - @Before + @BeforeEach public void setup() { this.negotiationStrategy = new HeaderContentNegotiationStrategy(); this.request = new MockHttpServletRequest(); diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherTests.java index 1c3a60220d..c76e1725ac 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcherTests.java @@ -20,11 +20,11 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.MediaType; import org.springframework.mock.web.MockHttpServletRequest; @@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * @author Dan Zheng */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MediaTypeRequestMatcherTests { private MediaTypeRequestMatcher matcher; @@ -51,7 +51,7 @@ public class MediaTypeRequestMatcherTests { @Mock private ContentNegotiationStrategy negotiationStrategy; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); } diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/NegatedRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/NegatedRequestMatcherTests.java index 39fae1ed4c..5192dcd9cc 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/NegatedRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/NegatedRequestMatcherTests.java @@ -18,10 +18,10 @@ package org.springframework.security.web.util.matcher; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -31,7 +31,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class NegatedRequestMatcherTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/OrRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/OrRequestMatcherTests.java index c67b961de5..37314e174c 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/OrRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/OrRequestMatcherTests.java @@ -22,10 +22,10 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -36,7 +36,7 @@ import static org.mockito.BDDMockito.given; * @author Rob Winch * */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class OrRequestMatcherTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/RegexRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/RegexRequestMatcherTests.java index 24f686c28b..3a87bdc5f9 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/RegexRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/RegexRequestMatcherTests.java @@ -18,10 +18,10 @@ package org.springframework.security.web.util.matcher; import javax.servlet.http.HttpServletRequest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockHttpServletRequest; @@ -32,7 +32,7 @@ import static org.mockito.BDDMockito.given; * @author Luke Taylor * @author Rob Winch */ -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class RegexRequestMatcherTests { @Mock diff --git a/web/src/test/java/org/springframework/security/web/util/matcher/RequestHeaderRequestMatcherTests.java b/web/src/test/java/org/springframework/security/web/util/matcher/RequestHeaderRequestMatcherTests.java index b27767f1c3..cc9da0354e 100644 --- a/web/src/test/java/org/springframework/security/web/util/matcher/RequestHeaderRequestMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/util/matcher/RequestHeaderRequestMatcherTests.java @@ -16,8 +16,8 @@ package org.springframework.security.web.util.matcher; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.mock.web.MockHttpServletRequest; @@ -36,7 +36,7 @@ public class RequestHeaderRequestMatcherTests { private MockHttpServletRequest request; - @Before + @BeforeEach public void setup() { this.request = new MockHttpServletRequest(); }