Polishing

This commit is contained in:
Sam Brannen
2024-09-25 17:28:47 +02:00
parent dea4f71846
commit b943bdeec2
8 changed files with 50 additions and 50 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -81,4 +81,5 @@ final class TestBeanOverrideMetadata extends OverrideMetadata {
public int hashCode() {
return this.overrideMethod.hashCode() * 29 + super.hashCode();
}
}