Skip to content

Commit 00d248b

Browse files
Fix failing tests
Issue gh-2107
1 parent 13b0e5c commit 00d248b

File tree

7 files changed

+20
-6
lines changed

7 files changed

+20
-6
lines changed

gradle/dependency-management.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencyManagement {
66
mavenBom 'org.springframework:spring-framework-bom:6.0.0-SNAPSHOT'
77
mavenBom 'org.springframework.data:spring-data-bom:2022.0.0-M4'
88
mavenBom 'org.springframework.security:spring-security-bom:6.0.0-SNAPSHOT'
9-
mavenBom 'org.testcontainers:testcontainers-bom:1.16.2'
9+
mavenBom 'org.testcontainers:testcontainers-bom:1.17.3'
1010
}
1111

1212
dependencies {

spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfigurationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.junit.jupiter.api.Test;
2525

2626
import org.springframework.beans.factory.BeanCreationException;
27+
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
2728
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2829
import org.springframework.context.annotation.Bean;
2930
import org.springframework.context.annotation.Configuration;
@@ -206,6 +207,7 @@ void namedConnectionFactoryRedisConfig() {
206207
void multipleConnectionFactoryRedisConfig() {
207208
assertThatExceptionOfType(BeanCreationException.class)
208209
.isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class))
210+
.withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause()
209211
.withMessageContaining("expected single matching bean but found 2");
210212
}
211213

spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/http/RedisIndexedHttpSessionConfigurationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.junit.jupiter.api.Test;
2525

2626
import org.springframework.beans.factory.BeanCreationException;
27+
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
2728
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2829
import org.springframework.context.annotation.Bean;
2930
import org.springframework.context.annotation.Configuration;
@@ -219,6 +220,7 @@ void namedConnectionFactoryRedisConfig() {
219220
void multipleConnectionFactoryRedisConfig() {
220221
assertThatExceptionOfType(BeanCreationException.class)
221222
.isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class))
223+
.withRootCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingRootCause()
222224
.withMessageContaining("expected single matching bean but found 2");
223225
}
224226

spring-session-data-redis/src/test/java/org/springframework/session/data/redis/config/annotation/web/server/RedisWebSessionConfigurationTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
import org.junit.jupiter.api.Test;
2222

2323
import org.springframework.beans.factory.BeanCreationException;
24+
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
2425
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2526
import org.springframework.context.annotation.Bean;
2627
import org.springframework.context.annotation.Configuration;
@@ -188,6 +189,7 @@ void namedConnectionFactoryRedisConfig() {
188189
void multipleConnectionFactoryRedisConfig() {
189190
assertThatExceptionOfType(BeanCreationException.class)
190191
.isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class))
192+
.withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause()
191193
.withMessageContaining("expected single matching bean but found 2");
192194
}
193195

spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2021 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@
2222
import org.junit.jupiter.api.Test;
2323

2424
import org.springframework.beans.factory.BeanCreationException;
25+
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
26+
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
2527
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2628
import org.springframework.context.annotation.Bean;
2729
import org.springframework.context.annotation.Configuration;
@@ -68,6 +70,7 @@ void closeContext() {
6870
void noHazelcastInstanceConfiguration() {
6971
assertThatExceptionOfType(BeanCreationException.class)
7072
.isThrownBy(() -> registerAndRefresh(NoHazelcastInstanceConfiguration.class))
73+
.withCauseInstanceOf(NoSuchBeanDefinitionException.class).havingCause()
7174
.withMessageContaining("HazelcastInstance");
7275
}
7376

@@ -222,6 +225,7 @@ void namedHazelcastInstanceConfiguration() {
222225
void multipleHazelcastInstanceConfiguration() {
223226
assertThatExceptionOfType(BeanCreationException.class)
224227
.isThrownBy(() -> registerAndRefresh(MultipleHazelcastInstanceConfiguration.class))
228+
.withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause()
225229
.withMessageContaining("expected single matching bean but found 2");
226230
}
227231

spring-session-jdbc/src/test/java/org/springframework/session/jdbc/config/annotation/web/http/JdbcHttpSessionConfigurationTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@
2222
import org.junit.jupiter.api.Test;
2323

2424
import org.springframework.beans.factory.BeanCreationException;
25+
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
26+
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
2527
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2628
import org.springframework.context.annotation.Bean;
2729
import org.springframework.context.annotation.Configuration;
@@ -75,6 +77,7 @@ void closeContext() {
7577
void noDataSourceConfiguration() {
7678
assertThatExceptionOfType(BeanCreationException.class)
7779
.isThrownBy(() -> registerAndRefresh(NoDataSourceConfiguration.class))
80+
.withRootCauseInstanceOf(NoSuchBeanDefinitionException.class).havingRootCause()
7881
.withMessageContaining("expected at least 1 bean which qualifies as autowire candidate");
7982
}
8083

@@ -230,6 +233,7 @@ void multipleDataSourceConfiguration() {
230233
assertThatExceptionOfType(BeanCreationException.class)
231234
.isThrownBy(
232235
() -> registerAndRefresh(DataSourceConfiguration.class, MultipleDataSourceConfiguration.class))
236+
.withRootCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingRootCause()
233237
.withMessageContaining("expected single matching bean but found 2");
234238
}
235239

spring-session-samples/spring-session-sample-javaconfig-hazelcast/src/integration-test/java/sample/HazelcastSpringTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ class HazelcastSpringTests {
3434

3535
@BeforeEach
3636
void setup() {
37-
this.driver = new HtmlUnitDriver();
37+
this.driver = new HtmlUnitDriver(true);
3838
}
3939

4040
@AfterEach

0 commit comments

Comments
 (0)