Polishing
This commit is contained in:
@@ -149,8 +149,10 @@ class BeanOverrideBeanFactoryPostProcessor implements BeanFactoryPostProcessor,
|
||||
existingBeanDefinition = beanFactory.getBeanDefinition(beanName);
|
||||
}
|
||||
else if (enforceExistingDefinition) {
|
||||
throw new IllegalStateException("Unable to override bean '" + beanName + "': there is no " +
|
||||
"bean definition to replace with that name of type " + overrideMetadata.getBeanType());
|
||||
throw new IllegalStateException("""
|
||||
Unable to override bean: there is no bean definition to replace \
|
||||
with name [%s] and type [%s]."""
|
||||
.formatted(beanName, overrideMetadata.getBeanType()));
|
||||
}
|
||||
beanNameIncludingFactory = beanName;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ public interface BeanOverrideProcessor {
|
||||
|
||||
/**
|
||||
* Create an {@link OverrideMetadata} instance for the given annotated field.
|
||||
* @param overrideAnnotation the composed annotation that defines the
|
||||
* {@link BeanOverride @BeanOverride} that triggers this processor
|
||||
* @param testClass the test class being processed
|
||||
* @param overrideAnnotation the composed annotation that declares the
|
||||
* {@link BeanOverride @BeanOverride} annotation that triggers this processor
|
||||
* @param testClass the test class to process
|
||||
* @param field the annotated field
|
||||
* @return the {@link OverrideMetadata} instance that should handle the
|
||||
* given field
|
||||
|
||||
@@ -81,4 +81,5 @@ final class TestBeanOverrideMetadata extends OverrideMetadata {
|
||||
public int hashCode() {
|
||||
return this.overrideMethod.hashCode() * 29 + super.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user