use of cn.taketoday.beans.factory.support.SimpleBeanDefinitionRegistry in project today-infrastructure by TAKETODAY.
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);
}
use of cn.taketoday.beans.factory.support.SimpleBeanDefinitionRegistry in project today-infrastructure by TAKETODAY.
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 cn.taketoday.beans.factory.support.SimpleBeanDefinitionRegistry in project today-infrastructure by TAKETODAY.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromMetaComponentWithStringValue.
@Test
public void generateBeanNameFromMetaComponentWithStringValue() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertThat(beanName).isEqualTo("henry");
}
use of cn.taketoday.beans.factory.support.SimpleBeanDefinitionRegistry in project today-infrastructure by TAKETODAY.
the class XmlBeanDefinitionReaderTests method withOpenInputStream.
@Test
public void withOpenInputStream() {
SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
Resource resource = new InputStreamResource(getClass().getResourceAsStream("test.xml"));
assertThatExceptionOfType(BeanDefinitionStoreException.class).isThrownBy(() -> new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource));
}
use of cn.taketoday.beans.factory.support.SimpleBeanDefinitionRegistry in project today-infrastructure by TAKETODAY.
the class XmlBeanDefinitionReaderTests method withImport.
@Test
public void withImport() {
SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
Resource resource = new ClassPathResource("import.xml", getClass());
new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
testBeanDefinitions(registry);
}
Aggregations