use of cn.taketoday.beans.factory.support.DefaultBeanDefinitionRegistry in project today-framework by TAKETODAY.
the class AnnotationBeanNamePopulatorTests method generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName.
@Test
public void generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
BeanDefinitionRegistry registry = new DefaultBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnonymousComponent.class);
String beanName = this.beanNamePopulator.populateName(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.beanNamePopulator.buildDefaultBeanName(bd);
assertThat(beanName).isEqualTo(expectedGeneratedBeanName);
}
use of cn.taketoday.beans.factory.support.DefaultBeanDefinitionRegistry in project today-framework by TAKETODAY.
the class AnnotationBeanNamePopulatorTests method generateBeanNameFromComposedControllerAnnotationWithBlankName.
@Test
public void generateBeanNameFromComposedControllerAnnotationWithBlankName() {
// SPR-11360
BeanDefinitionRegistry registry = new DefaultBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithBlankName.class);
String beanName = this.beanNamePopulator.populateName(bd, registry);
String expectedGeneratedBeanName = this.beanNamePopulator.buildDefaultBeanName(bd);
assertThat(beanName).isEqualTo(expectedGeneratedBeanName);
}
use of cn.taketoday.beans.factory.support.DefaultBeanDefinitionRegistry in project today-framework by TAKETODAY.
the class AnnotationBeanNamePopulatorTests method generateBeanNameWithNamedComponent.
@Test
public void generateBeanNameWithNamedComponent() {
BeanDefinitionRegistry registry = new DefaultBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithName.class);
String beanName = this.beanNamePopulator.populateName(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 cn.taketoday.beans.factory.support.DefaultBeanDefinitionRegistry in project today-framework by TAKETODAY.
the class AnnotationBeanNamePopulatorTests method generateBeanNameWithDefaultNamedComponent.
@Test
public void generateBeanNameWithDefaultNamedComponent() {
BeanDefinitionRegistry registry = new DefaultBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(DefaultNamedComponent.class);
String beanName = this.beanNamePopulator.populateName(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("thoreau");
}
use of cn.taketoday.beans.factory.support.DefaultBeanDefinitionRegistry in project today-framework by TAKETODAY.
the class AnnotationBeanNamePopulatorTests method generateBeanNameFromComposedControllerAnnotationWithoutName.
@Test
public void generateBeanNameFromComposedControllerAnnotationWithoutName() {
// SPR-11360
BeanDefinitionRegistry registry = new DefaultBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithoutName.class);
String beanName = this.beanNamePopulator.populateName(bd, registry);
String expectedGeneratedBeanName = this.beanNamePopulator.buildDefaultBeanName(bd);
assertThat(beanName).isEqualTo(expectedGeneratedBeanName);
}
Aggregations