diff --git a/gradle/dependency-management.gradle b/gradle/dependency-management.gradle index 0369f3b5..c33ea24a 100644 --- a/gradle/dependency-management.gradle +++ b/gradle/dependency-management.gradle @@ -6,7 +6,7 @@ dependencyManagement { mavenBom 'org.springframework:spring-framework-bom:6.0.0-SNAPSHOT' mavenBom 'org.springframework.data:spring-data-bom:2022.0.0-M4' mavenBom 'org.springframework.security:spring-security-bom:6.0.0-SNAPSHOT' - mavenBom 'org.testcontainers:testcontainers-bom:1.16.2' + mavenBom 'org.testcontainers:testcontainers-bom:1.17.3' } dependencies { diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java index 26f138c8..1d0736b1 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -206,6 +207,7 @@ class RedisHttpSessionConfigurationTests { void multipleConnectionFactoryRedisConfig() { assertThatExceptionOfType(BeanCreationException.class) .isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class)) + .withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause() .withMessageContaining("expected single matching bean but found 2"); } diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationTests.java index 7288067f..7e68d023 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationTests.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -219,6 +220,7 @@ class RedisIndexedHttpSessionConfigurationTests { void multipleConnectionFactoryRedisConfig() { assertThatExceptionOfType(BeanCreationException.class) .isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class)) + .withRootCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingRootCause() .withMessageContaining("expected single matching bean but found 2"); } diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java index b53697c1..2b7041ca 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -188,6 +189,7 @@ class RedisWebSessionConfigurationTests { void multipleConnectionFactoryRedisConfig() { assertThatExceptionOfType(BeanCreationException.class) .isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class)) + .withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause() .withMessageContaining("expected single matching bean but found 2"); } diff --git a/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java b/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java index 4d14fc6b..96fc1803 100644 --- a/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java +++ b/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 the original author or authors. + * Copyright 2014-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -68,6 +70,7 @@ class HazelcastHttpSessionConfigurationTests { void noHazelcastInstanceConfiguration() { assertThatExceptionOfType(BeanCreationException.class) .isThrownBy(() -> registerAndRefresh(NoHazelcastInstanceConfiguration.class)) + .withCauseInstanceOf(NoSuchBeanDefinitionException.class).havingCause() .withMessageContaining("HazelcastInstance"); } @@ -222,6 +225,7 @@ class HazelcastHttpSessionConfigurationTests { void multipleHazelcastInstanceConfiguration() { assertThatExceptionOfType(BeanCreationException.class) .isThrownBy(() -> registerAndRefresh(MultipleHazelcastInstanceConfiguration.class)) + .withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause() .withMessageContaining("expected single matching bean but found 2"); } diff --git a/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java b/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java index d237f5cd..ba12af74 100644 --- a/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java +++ b/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -75,6 +77,7 @@ class JdbcHttpSessionConfigurationTests { void noDataSourceConfiguration() { assertThatExceptionOfType(BeanCreationException.class) .isThrownBy(() -> registerAndRefresh(NoDataSourceConfiguration.class)) + .withRootCauseInstanceOf(NoSuchBeanDefinitionException.class).havingRootCause() .withMessageContaining("expected at least 1 bean which qualifies as autowire candidate"); } @@ -230,6 +233,7 @@ class JdbcHttpSessionConfigurationTests { assertThatExceptionOfType(BeanCreationException.class) .isThrownBy( () -> registerAndRefresh(DataSourceConfiguration.class, MultipleDataSourceConfiguration.class)) + .withRootCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingRootCause() .withMessageContaining("expected single matching bean but found 2"); } diff --git a/spring-session-samples/spring-session-sample-javaconfig-hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java b/spring-session-samples/spring-session-sample-javaconfig-hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java index e5d08caa..731d7d5d 100644 --- a/spring-session-samples/spring-session-sample-javaconfig-hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java +++ b/spring-session-samples/spring-session-sample-javaconfig-hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ class HazelcastSpringTests { @BeforeEach void setup() { - this.driver = new HtmlUnitDriver(); + this.driver = new HtmlUnitDriver(true); } @AfterEach