|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -436,7 +436,6 @@ class DefaultListableBeanFactoryTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void empty() { |
|
|
|
void empty() { |
|
|
|
ListableBeanFactory lbf = new DefaultListableBeanFactory(); |
|
|
|
|
|
|
|
assertThat(lbf.getBeanDefinitionNames() != null).as("No beans defined --> array != null").isTrue(); |
|
|
|
assertThat(lbf.getBeanDefinitionNames() != null).as("No beans defined --> array != null").isTrue(); |
|
|
|
assertThat(lbf.getBeanDefinitionNames().length == 0).as("No beans defined after no arg constructor").isTrue(); |
|
|
|
assertThat(lbf.getBeanDefinitionNames().length == 0).as("No beans defined after no arg constructor").isTrue(); |
|
|
|
assertThat(lbf.getBeanDefinitionCount() == 0).as("No beans defined after no arg constructor").isTrue(); |
|
|
|
assertThat(lbf.getBeanDefinitionCount() == 0).as("No beans defined after no arg constructor").isTrue(); |
|
|
|
@ -778,21 +777,6 @@ class DefaultListableBeanFactoryTests { |
|
|
|
assertThat(factory.getType("child")).isEqualTo(DerivedTestBean.class); |
|
|
|
assertThat(factory.getType("child")).isEqualTo(DerivedTestBean.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
void nameAlreadyBound() { |
|
|
|
|
|
|
|
Properties p = new Properties(); |
|
|
|
|
|
|
|
p.setProperty("kerry.(class)", TestBean.class.getName()); |
|
|
|
|
|
|
|
p.setProperty("kerry.age", "35"); |
|
|
|
|
|
|
|
registerBeanDefinitions(p); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
registerBeanDefinitions(p); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (BeanDefinitionStoreException ex) { |
|
|
|
|
|
|
|
assertThat(ex.getBeanName()).isEqualTo("kerry"); |
|
|
|
|
|
|
|
// expected
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void singleTestBean(ListableBeanFactory lbf) { |
|
|
|
private void singleTestBean(ListableBeanFactory lbf) { |
|
|
|
assertThat(lbf.getBeanDefinitionCount() == 1).as("1 beans defined").isTrue(); |
|
|
|
assertThat(lbf.getBeanDefinitionCount() == 1).as("1 beans defined").isTrue(); |
|
|
|
String[] names = lbf.getBeanDefinitionNames(); |
|
|
|
String[] names = lbf.getBeanDefinitionNames(); |
|
|
|
|