Merge branch '6.2.x'

This commit is contained in:
Sam Brannen
2025-02-10 11:49:50 +01:00
5 changed files with 53 additions and 21 deletions

View File

@@ -87,7 +87,9 @@ class BeanOverrideBeanFactoryPostProcessorTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to replace bean: there is no bean with name 'descriptionBean' \
and type java.lang.String (as required by field 'ByNameTestCase.description').""");
and type java.lang.String (as required by field 'ByNameTestCase.description'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test
@@ -99,7 +101,9 @@ class BeanOverrideBeanFactoryPostProcessorTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to replace bean: there is no bean with name 'descriptionBean' \
and type java.lang.String (as required by field 'ByNameTestCase.description').""");
and type java.lang.String (as required by field 'ByNameTestCase.description'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test
@@ -146,7 +150,9 @@ class BeanOverrideBeanFactoryPostProcessorTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to override bean: there are no beans of type java.lang.Integer \
(as required by field 'ByTypeTestCase.counter').""");
(as required by field 'ByTypeTestCase.counter'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test

View File

@@ -42,7 +42,9 @@ public class TestBeanTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to replace bean: there is no bean with name 'beanToOverride' \
and type java.lang.String (as required by field 'FailureByNameLookup.example').""");
and type java.lang.String (as required by field 'FailureByNameLookup.example'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test
@@ -54,7 +56,9 @@ public class TestBeanTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to replace bean: there is no bean with name 'beanToOverride' \
and type java.lang.String (as required by field 'FailureByNameLookup.example').""");
and type java.lang.String (as required by field 'FailureByNameLookup.example'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test
@@ -64,8 +68,9 @@ public class TestBeanTests {
assertThatIllegalStateException()
.isThrownBy(context::refresh)
.withMessage("""
Unable to override bean: there are no beans of \
type %s (as required by field '%s.example').""",
Unable to override bean: there are no beans of type %s (as required by field '%s.example'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""",
String.class.getName(), FailureByTypeLookup.class.getSimpleName());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -42,7 +42,9 @@ class MockitoBeanConfigurationErrorTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to replace bean: there is no bean with name 'beanToOverride' \
and type java.lang.String (as required by field 'FailureByNameLookup.example').""");
and type java.lang.String (as required by field 'FailureByNameLookup.example'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test
@@ -54,7 +56,9 @@ class MockitoBeanConfigurationErrorTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to replace bean: there is no bean with name 'beanToOverride' \
and type java.lang.String (as required by field 'FailureByNameLookup.example').""");
and type java.lang.String (as required by field 'FailureByNameLookup.example'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test
@@ -65,7 +69,9 @@ class MockitoBeanConfigurationErrorTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to override bean: there are no beans of \
type java.lang.String (as required by field 'FailureByTypeLookup.example').""");
type java.lang.String (as required by field 'FailureByTypeLookup.example'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -41,7 +41,9 @@ class MockitoSpyBeanConfigurationErrorTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to wrap bean: there is no bean with name 'beanToSpy' and \
type java.lang.String (as required by field 'ByNameSingleLookup.example').""");
type java.lang.String (as required by field 'ByNameSingleLookup.example'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test
@@ -52,7 +54,9 @@ class MockitoSpyBeanConfigurationErrorTests {
.isThrownBy(context::refresh)
.withMessage("""
Unable to select a bean to wrap: there are no beans of type java.lang.String \
(as required by field 'ByTypeSingleLookup.example').""");
(as required by field 'ByTypeSingleLookup.example'). \
If the bean is defined in a @Bean method, make sure the return type is the most \
specific type possible (for example, the concrete implementation type).""");
}
@Test