Merge branch '6.2.x'
This commit is contained in:
commit
a3594e7207
|
@ -64,8 +64,8 @@ public class TestBeanTests {
|
||||||
.isThrownBy(context::refresh)
|
.isThrownBy(context::refresh)
|
||||||
.withMessage("""
|
.withMessage("""
|
||||||
Unable to override bean: there are no beans of \
|
Unable to override bean: there are no beans of \
|
||||||
type %s (as required by field '%s.example').""".formatted(
|
type %s (as required by field '%s.example').""",
|
||||||
String.class.getName(), FailureByTypeLookup.class.getSimpleName()));
|
String.class.getName(), FailureByTypeLookup.class.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -87,8 +87,8 @@ public class TestBeanTests {
|
||||||
assertThatIllegalStateException()
|
assertThatIllegalStateException()
|
||||||
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
|
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
|
||||||
FailureMissingDefaultOverrideMethod.class, context))
|
FailureMissingDefaultOverrideMethod.class, context))
|
||||||
.withMessage("No static method found named example() or beanToOverride() in %s with return type %s"
|
.withMessage("No static method found named example() or beanToOverride() in %s with return type %s",
|
||||||
.formatted(FailureMissingDefaultOverrideMethod.class.getName(), String.class.getName()));
|
FailureMissingDefaultOverrideMethod.class.getName(), String.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -97,8 +97,8 @@ public class TestBeanTests {
|
||||||
assertThatIllegalStateException()
|
assertThatIllegalStateException()
|
||||||
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
|
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
|
||||||
FailureMissingExplicitOverrideMethod.class, context))
|
FailureMissingExplicitOverrideMethod.class, context))
|
||||||
.withMessage("No static method found named createExample() in %s with return type %s"
|
.withMessage("No static method found named createExample() in %s with return type %s",
|
||||||
.formatted(FailureMissingExplicitOverrideMethod.class.getName(), String.class.getName()));
|
FailureMissingExplicitOverrideMethod.class.getName(), String.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -108,8 +108,8 @@ public class TestBeanTests {
|
||||||
assertThatIllegalStateException()
|
assertThatIllegalStateException()
|
||||||
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
|
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
|
||||||
FailureOverrideInParentWithoutFactoryMethod.class, context))
|
FailureOverrideInParentWithoutFactoryMethod.class, context))
|
||||||
.withMessage("No static method found named beanToOverride() in %s with return type %s"
|
.withMessage("No static method found named beanToOverride() in %s with return type %s",
|
||||||
.formatted(FailureOverrideInParentWithoutFactoryMethod.class.getName(), String.class.getName()));
|
FailureOverrideInParentWithoutFactoryMethod.class.getName(), String.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -119,8 +119,8 @@ public class TestBeanTests {
|
||||||
assertThatIllegalStateException()
|
assertThatIllegalStateException()
|
||||||
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
|
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
|
||||||
FailureCompetingOverrideMethods.class, context))
|
FailureCompetingOverrideMethods.class, context))
|
||||||
.withMessage("Found 2 competing static methods named example() or beanToOverride() in %s with return type %s"
|
.withMessage("Found 2 competing static methods named example() or beanToOverride() in %s with return type %s",
|
||||||
.formatted(FailureCompetingOverrideMethods.class.getName(), String.class.getName()));
|
FailureCompetingOverrideMethods.class.getName(), String.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,6 @@ public class TestBeanTests {
|
||||||
|
|
||||||
// Expected static String example() { ... }
|
// Expected static String example() { ... }
|
||||||
// or static String beanToOverride() { ... }
|
// or static String beanToOverride() { ... }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class FailureMissingExplicitOverrideMethod {
|
static class FailureMissingExplicitOverrideMethod {
|
||||||
|
@ -160,20 +159,17 @@ public class TestBeanTests {
|
||||||
private String example;
|
private String example;
|
||||||
|
|
||||||
// Expected static String createExample() { ... }
|
// Expected static String createExample() { ... }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract static class AbstractByNameLookup {
|
abstract static class AbstractByNameLookup {
|
||||||
|
|
||||||
@TestBean(methodName = "beanToOverride")
|
@TestBean(methodName = "beanToOverride")
|
||||||
protected String beanToOverride;
|
protected String beanToOverride;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class FailureOverrideInParentWithoutFactoryMethod extends AbstractByNameLookup {
|
static class FailureOverrideInParentWithoutFactoryMethod extends AbstractByNameLookup {
|
||||||
|
|
||||||
// No beanToOverride() method
|
// No beanToOverride() method
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract static class AbstractCompetingMethods {
|
abstract static class AbstractCompetingMethods {
|
||||||
|
@ -191,7 +187,6 @@ public class TestBeanTests {
|
||||||
static String beanToOverride() {
|
static String beanToOverride() {
|
||||||
throw new IllegalStateException("Should not be called");
|
throw new IllegalStateException("Should not be called");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue