Fix failing tests

Issue gh-2107
This commit is contained in:
Marcus Da Coregio
2022-07-08 11:05:17 -03:00
parent 13b0e5cc8a
commit 00d248b0b5
7 changed files with 20 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ dependencyManagement {
mavenBom 'org.springframework:spring-framework-bom:6.0.0-SNAPSHOT' mavenBom 'org.springframework:spring-framework-bom:6.0.0-SNAPSHOT'
mavenBom 'org.springframework.data:spring-data-bom:2022.0.0-M4' mavenBom 'org.springframework.data:spring-data-bom:2022.0.0-M4'
mavenBom 'org.springframework.security:spring-security-bom:6.0.0-SNAPSHOT' 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 { dependencies {

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@@ -206,6 +207,7 @@ class RedisHttpSessionConfigurationTests {
void multipleConnectionFactoryRedisConfig() { void multipleConnectionFactoryRedisConfig() {
assertThatExceptionOfType(BeanCreationException.class) assertThatExceptionOfType(BeanCreationException.class)
.isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class)) .isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class))
.withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause()
.withMessageContaining("expected single matching bean but found 2"); .withMessageContaining("expected single matching bean but found 2");
} }

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@@ -219,6 +220,7 @@ class RedisIndexedHttpSessionConfigurationTests {
void multipleConnectionFactoryRedisConfig() { void multipleConnectionFactoryRedisConfig() {
assertThatExceptionOfType(BeanCreationException.class) assertThatExceptionOfType(BeanCreationException.class)
.isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class)) .isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class))
.withRootCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingRootCause()
.withMessageContaining("expected single matching bean but found 2"); .withMessageContaining("expected single matching bean but found 2");
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@@ -188,6 +189,7 @@ class RedisWebSessionConfigurationTests {
void multipleConnectionFactoryRedisConfig() { void multipleConnectionFactoryRedisConfig() {
assertThatExceptionOfType(BeanCreationException.class) assertThatExceptionOfType(BeanCreationException.class)
.isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class)) .isThrownBy(() -> registerAndRefresh(RedisConfig.class, MultipleConnectionFactoryRedisConfig.class))
.withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause()
.withMessageContaining("expected single matching bean but found 2"); .withMessageContaining("expected single matching bean but found 2");
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException; 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.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@@ -68,6 +70,7 @@ class HazelcastHttpSessionConfigurationTests {
void noHazelcastInstanceConfiguration() { void noHazelcastInstanceConfiguration() {
assertThatExceptionOfType(BeanCreationException.class) assertThatExceptionOfType(BeanCreationException.class)
.isThrownBy(() -> registerAndRefresh(NoHazelcastInstanceConfiguration.class)) .isThrownBy(() -> registerAndRefresh(NoHazelcastInstanceConfiguration.class))
.withCauseInstanceOf(NoSuchBeanDefinitionException.class).havingCause()
.withMessageContaining("HazelcastInstance"); .withMessageContaining("HazelcastInstance");
} }
@@ -222,6 +225,7 @@ class HazelcastHttpSessionConfigurationTests {
void multipleHazelcastInstanceConfiguration() { void multipleHazelcastInstanceConfiguration() {
assertThatExceptionOfType(BeanCreationException.class) assertThatExceptionOfType(BeanCreationException.class)
.isThrownBy(() -> registerAndRefresh(MultipleHazelcastInstanceConfiguration.class)) .isThrownBy(() -> registerAndRefresh(MultipleHazelcastInstanceConfiguration.class))
.withCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingCause()
.withMessageContaining("expected single matching bean but found 2"); .withMessageContaining("expected single matching bean but found 2");
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException; 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.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@@ -75,6 +77,7 @@ class JdbcHttpSessionConfigurationTests {
void noDataSourceConfiguration() { void noDataSourceConfiguration() {
assertThatExceptionOfType(BeanCreationException.class) assertThatExceptionOfType(BeanCreationException.class)
.isThrownBy(() -> registerAndRefresh(NoDataSourceConfiguration.class)) .isThrownBy(() -> registerAndRefresh(NoDataSourceConfiguration.class))
.withRootCauseInstanceOf(NoSuchBeanDefinitionException.class).havingRootCause()
.withMessageContaining("expected at least 1 bean which qualifies as autowire candidate"); .withMessageContaining("expected at least 1 bean which qualifies as autowire candidate");
} }
@@ -230,6 +233,7 @@ class JdbcHttpSessionConfigurationTests {
assertThatExceptionOfType(BeanCreationException.class) assertThatExceptionOfType(BeanCreationException.class)
.isThrownBy( .isThrownBy(
() -> registerAndRefresh(DataSourceConfiguration.class, MultipleDataSourceConfiguration.class)) () -> registerAndRefresh(DataSourceConfiguration.class, MultipleDataSourceConfiguration.class))
.withRootCauseInstanceOf(NoUniqueBeanDefinitionException.class).havingRootCause()
.withMessageContaining("expected single matching bean but found 2"); .withMessageContaining("expected single matching bean but found 2");
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ class HazelcastSpringTests {
@BeforeEach @BeforeEach
void setup() { void setup() {
this.driver = new HtmlUnitDriver(); this.driver = new HtmlUnitDriver(true);
} }
@AfterEach @AfterEach