use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameWithNamedComponent.
@Test
public void generateBeanNameWithNamedComponent() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithName.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertThat(beanName).as("The generated beanName must *never* be null.").isNotNull();
assertThat(StringUtils.hasText(beanName)).as("The generated beanName must *never* be blank.").isTrue();
assertThat(beanName).isEqualTo("walden");
}
use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromMetaComponentWithNonStringValue.
@Test
public void generateBeanNameFromMetaComponentWithNonStringValue() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromNonStringMeta.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertThat(beanName).isEqualTo("annotationBeanNameGeneratorTests.ComponentFromNonStringMeta");
}
use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromComposedControllerAnnotationWithoutName.
@Test
public void generateBeanNameFromComposedControllerAnnotationWithoutName() {
// SPR-11360
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithoutName.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
assertThat(beanName).isEqualTo(expectedGeneratedBeanName);
}
use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName.
@Test
public void generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnonymousComponent.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertThat(beanName).as("The generated beanName must *never* be null.").isNotNull();
assertThat(StringUtils.hasText(beanName)).as("The generated beanName must *never* be blank.").isTrue();
String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
assertThat(beanName).isEqualTo(expectedGeneratedBeanName);
}
use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project spring-framework by spring-projects.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromComposedControllerAnnotationWithBlankName.
@Test
public void generateBeanNameFromComposedControllerAnnotationWithBlankName() {
// SPR-11360
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithBlankName.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
assertThat(beanName).isEqualTo(expectedGeneratedBeanName);
}
Aggregations