Merge branch '7.0.x'

This commit is contained in:
Sam Brannen
2026-03-18 18:19:31 +01:00
591 changed files with 3284 additions and 3306 deletions
@@ -375,7 +375,7 @@ abstract class AbstractPropertyAccessorTests {
}
@Test
void testErrorMessageOfNestedProperty() {
void errorMessageOfNestedProperty() {
ITestBean target = new TestBean();
ITestBean child = new DifferentTestBean();
child.setName("test");
@@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class BeanWrapperEnumTests {
@Test
void testCustomEnum() {
void customEnum() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", "VALUE_1");
@@ -42,7 +42,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumWithNull() {
void customEnumWithNull() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", null);
@@ -50,7 +50,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumWithEmptyString() {
void customEnumWithEmptyString() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", "");
@@ -58,7 +58,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumArrayWithSingleValue() {
void customEnumArrayWithSingleValue() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", "VALUE_1");
@@ -67,7 +67,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumArrayWithMultipleValues() {
void customEnumArrayWithMultipleValues() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", new String[] {"VALUE_1", "VALUE_2"});
@@ -77,7 +77,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumArrayWithMultipleValuesAsCsv() {
void customEnumArrayWithMultipleValuesAsCsv() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", "VALUE_1,VALUE_2");
@@ -87,7 +87,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumSetWithSingleValue() {
void customEnumSetWithSingleValue() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", "VALUE_1");
@@ -96,7 +96,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumSetWithMultipleValues() {
void customEnumSetWithMultipleValues() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", new String[] {"VALUE_1", "VALUE_2"});
@@ -106,7 +106,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumSetWithMultipleValuesAsCsv() {
void customEnumSetWithMultipleValuesAsCsv() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", "VALUE_1,VALUE_2");
@@ -116,7 +116,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumSetWithGetterSetterMismatch() {
void customEnumSetWithGetterSetterMismatch() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSetMismatch", new String[] {"VALUE_1", "VALUE_2"});
@@ -126,7 +126,7 @@ class BeanWrapperEnumTests {
}
@Test
void testStandardEnumSetWithMultipleValues() {
void standardEnumSetWithMultipleValues() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setConversionService(new DefaultConversionService());
@@ -138,7 +138,7 @@ class BeanWrapperEnumTests {
}
@Test
void testStandardEnumSetWithAutoGrowing() {
void standardEnumSetWithAutoGrowing() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setAutoGrowNestedPaths(true);
@@ -148,7 +148,7 @@ class BeanWrapperEnumTests {
}
@Test
void testStandardEnumMapWithMultipleValues() {
void standardEnumMapWithMultipleValues() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setConversionService(new DefaultConversionService());
@@ -163,7 +163,7 @@ class BeanWrapperEnumTests {
}
@Test
void testStandardEnumMapWithAutoGrowing() {
void standardEnumMapWithAutoGrowing() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setAutoGrowNestedPaths(true);
@@ -174,7 +174,7 @@ class BeanWrapperEnumTests {
}
@Test
void testNonPublicEnum() {
void nonPublicEnum() {
NonPublicEnumHolder holder = new NonPublicEnumHolder();
BeanWrapper bw = new BeanWrapperImpl(holder);
bw.setPropertyValue("nonPublicEnum", "VALUE_1");
@@ -52,7 +52,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
class BeanWrapperGenericsTests {
@Test
void testGenericSet() {
void genericSet() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Set<String> input = new HashSet<>();
@@ -64,7 +64,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericLowerBoundedSet() {
void genericLowerBoundedSet() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, true));
@@ -77,7 +77,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericSetWithConversionFailure() {
void genericSetWithConversionFailure() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Set<TestBean> input = new HashSet<>();
@@ -88,7 +88,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericList() throws Exception {
void genericList() throws Exception {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
List<String> input = new ArrayList<>();
@@ -100,7 +100,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListElement() throws Exception {
void genericListElement() throws Exception {
GenericBean<?> gb = new GenericBean<>();
gb.setResourceList(new ArrayList<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
@@ -109,7 +109,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMap() {
void genericMap() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Map<String, String> input = new HashMap<>();
@@ -121,7 +121,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapElement() {
void genericMapElement() {
GenericBean<?> gb = new GenericBean<>();
gb.setShortMap(new HashMap<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
@@ -131,7 +131,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapWithKeyType() {
void genericMapWithKeyType() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Map<String, String> input = new HashMap<>();
@@ -143,7 +143,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapElementWithKeyType() {
void genericMapElementWithKeyType() {
GenericBean<?> gb = new GenericBean<>();
gb.setLongMap(new HashMap<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
@@ -153,7 +153,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapWithCollectionValue() {
void genericMapWithCollectionValue() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
@@ -170,7 +170,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapElementWithCollectionValue() {
void genericMapElementWithCollectionValue() {
GenericBean<?> gb = new GenericBean<>();
gb.setCollectionMap(new HashMap<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
@@ -182,7 +182,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapFromProperties() {
void genericMapFromProperties() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Properties input = new Properties();
@@ -194,7 +194,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfLists() {
void genericListOfLists() {
GenericBean<String> gb = new GenericBean<>();
List<List<Integer>> list = new ArrayList<>();
list.add(new ArrayList<>());
@@ -206,7 +206,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfListsWithElementConversion() {
void genericListOfListsWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
List<List<Integer>> list = new ArrayList<>();
list.add(new ArrayList<>());
@@ -218,7 +218,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfArrays() {
void genericListOfArrays() {
GenericBean<String> gb = new GenericBean<>();
ArrayList<String[]> list = new ArrayList<>();
list.add(new String[] {"str1", "str2"});
@@ -230,7 +230,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfArraysWithElementConversion() {
void genericListOfArraysWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
ArrayList<String[]> list = new ArrayList<>();
list.add(new String[] {"str1", "str2"});
@@ -243,7 +243,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfMaps() {
void genericListOfMaps() {
GenericBean<String> gb = new GenericBean<>();
List<Map<Integer, Long>> list = new ArrayList<>();
list.add(new HashMap<>());
@@ -255,7 +255,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfMapsWithElementConversion() {
void genericListOfMapsWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
List<Map<Integer, Long>> list = new ArrayList<>();
list.add(new HashMap<>());
@@ -267,7 +267,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapOfMaps() {
void genericMapOfMaps() {
GenericBean<String> gb = new GenericBean<>();
Map<String, Map<Integer, Long>> map = new HashMap<>();
map.put("mykey", new HashMap<>());
@@ -279,7 +279,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapOfMapsWithElementConversion() {
void genericMapOfMapsWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
Map<String, Map<Integer, Long>> map = new HashMap<>();
map.put("mykey", new HashMap<>());
@@ -291,7 +291,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapOfLists() {
void genericMapOfLists() {
GenericBean<String> gb = new GenericBean<>();
Map<Integer, List<Integer>> map = new HashMap<>();
map.put(1, new ArrayList<>());
@@ -303,7 +303,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapOfListsWithElementConversion() {
void genericMapOfListsWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
Map<Integer, List<Integer>> map = new HashMap<>();
map.put(1, new ArrayList<>());
@@ -315,7 +315,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericTypeNestingMapOfInteger() {
void genericTypeNestingMapOfInteger() {
Map<String, String> map = new HashMap<>();
map.put("testKey", "100");
@@ -328,7 +328,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericTypeNestingMapOfListOfInteger() {
void genericTypeNestingMapOfListOfInteger() {
Map<String, List<String>> map = new HashMap<>();
List<String> list = Arrays.asList("1", "2", "3");
map.put("testKey", list);
@@ -343,7 +343,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericTypeNestingListOfMapOfInteger() {
void genericTypeNestingListOfMapOfInteger() {
List<Map<String, String>> list = new ArrayList<>();
Map<String, String> map = new HashMap<>();
map.put("testKey", "5");
@@ -359,7 +359,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericTypeNestingMapOfListOfListOfInteger() {
void genericTypeNestingMapOfListOfListOfInteger() {
Map<String, List<List<String>>> map = new HashMap<>();
List<String> list = Arrays.asList("1", "2", "3");
map.put("testKey", Collections.singletonList(list));
@@ -374,7 +374,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericMap() {
void complexGenericMap() {
Map<List<String>, List<String>> inputMap = new HashMap<>();
List<String> inputKey = new ArrayList<>();
inputKey.add("1");
@@ -390,7 +390,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericMapWithCollectionConversion() {
void complexGenericMapWithCollectionConversion() {
Map<Set<String>, Set<String>> inputMap = new HashMap<>();
Set<String> inputKey = new HashSet<>();
inputKey.add("1");
@@ -406,7 +406,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericIndexedMapEntry() {
void complexGenericIndexedMapEntry() {
List<String> inputValue = new ArrayList<>();
inputValue.add("10");
@@ -418,7 +418,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericIndexedMapEntryWithCollectionConversion() {
void complexGenericIndexedMapEntryWithCollectionConversion() {
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
@@ -430,7 +430,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericIndexedMapEntryWithPlainValue() {
void complexGenericIndexedMapEntryWithPlainValue() {
String inputValue = "10";
ComplexMapHolder holder = new ComplexMapHolder();
@@ -441,7 +441,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexDerivedIndexedMapEntry() {
void complexDerivedIndexedMapEntry() {
List<String> inputValue = new ArrayList<>();
inputValue.add("10");
@@ -453,7 +453,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexDerivedIndexedMapEntryWithCollectionConversion() {
void complexDerivedIndexedMapEntryWithCollectionConversion() {
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
@@ -465,7 +465,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexDerivedIndexedMapEntryWithPlainValue() {
void complexDerivedIndexedMapEntryWithPlainValue() {
String inputValue = "10";
ComplexMapHolder holder = new ComplexMapHolder();
@@ -476,7 +476,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexMultiValueMapEntry() {
void complexMultiValueMapEntry() {
List<String> inputValue = new ArrayList<>();
inputValue.add("10");
@@ -488,7 +488,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexMultiValueMapEntryWithCollectionConversion() {
void complexMultiValueMapEntryWithCollectionConversion() {
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
@@ -500,7 +500,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexMultiValueMapEntryWithPlainValue() {
void complexMultiValueMapEntryWithPlainValue() {
String inputValue = "10";
ComplexMapHolder holder = new ComplexMapHolder();
@@ -511,7 +511,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericallyTypedIntegerBean() {
void genericallyTypedIntegerBean() {
GenericIntegerBean gb = new GenericIntegerBean();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("genericProperty", "10");
@@ -521,7 +521,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericallyTypedSetOfIntegerBean() {
void genericallyTypedSetOfIntegerBean() {
GenericSetOfIntegerBean gb = new GenericSetOfIntegerBean();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("genericProperty", "10");
@@ -532,7 +532,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testSettingGenericPropertyWithReadOnlyInterface() {
void settingGenericPropertyWithReadOnlyInterface() {
Bar bar = new Bar();
BeanWrapper bw = new BeanWrapperImpl(bar);
bw.setPropertyValue("version", "10");
@@ -540,7 +540,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testSettingLongPropertyWithGenericInterface() {
void settingLongPropertyWithGenericInterface() {
Promotion bean = new Promotion();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.setPropertyValue("id", "10");
@@ -548,7 +548,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testUntypedPropertyWithMapAtRuntime() {
void untypedPropertyWithMapAtRuntime() {
class Holder<D> {
private final D data;
public Holder(D data) {
@@ -45,12 +45,12 @@ class ConcurrentBeanWrapperTests {
private Throwable ex = null;
@RepeatedTest(100)
void testSingleThread() {
void singleThread() {
performSet();
}
@Test
void testConcurrent() {
void concurrent() {
for (int i = 0; i < 10; i++) {
TestRun run = new TestRun(this);
set.add(run);
@@ -40,12 +40,12 @@ class MutablePropertyValuesTests {
pvs.addPropertyValue(new PropertyValue("forname", "Tony"));
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));
pvs.addPropertyValue(new PropertyValue("age", "50"));
doTestTony(pvs);
assertPropertyValuesForTony(pvs);
MutablePropertyValues deepCopy = new MutablePropertyValues(pvs);
doTestTony(deepCopy);
assertPropertyValuesForTony(deepCopy);
deepCopy.setPropertyValueAt(new PropertyValue("name", "Gordon"), 0);
doTestTony(pvs);
assertPropertyValuesForTony(pvs);
assertThat(deepCopy.getPropertyValue("name").getValue()).isEqualTo("Gordon");
}
@@ -55,7 +55,7 @@ class MutablePropertyValuesTests {
pvs.addPropertyValue(new PropertyValue("forname", "Tony"));
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));
pvs.addPropertyValue(new PropertyValue("age", "50"));
doTestTony(pvs);
assertPropertyValuesForTony(pvs);
PropertyValue addedPv = new PropertyValue("rod", "Rod");
pvs.addPropertyValue(addedPv);
assertThat(pvs.getPropertyValue("rod")).isEqualTo(addedPv);
@@ -149,7 +149,7 @@ class MutablePropertyValuesTests {
/**
* Must contain: forname=Tony surname=Blair age=50
*/
protected void doTestTony(PropertyValues pvs) {
private static void assertPropertyValuesForTony(PropertyValues pvs) {
PropertyValue[] propertyValues = pvs.getPropertyValues();
assertThat(propertyValues).hasSize(3);
@@ -85,7 +85,7 @@ class BeanFactoryUtilsTests {
@Test
void testHierarchicalCountBeansWithNonHierarchicalFactory() {
void hierarchicalCountBeansWithNonHierarchicalFactory() {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
lbf.addBean("t1", new TestBean());
lbf.addBean("t2", new TestBean());
@@ -96,7 +96,7 @@ class BeanFactoryUtilsTests {
* Check that override doesn't count as two separate beans.
*/
@Test
void testHierarchicalCountBeansWithOverride() {
void hierarchicalCountBeansWithOverride() {
// Leaf count
assertThat(this.listableBeanFactory.getBeanDefinitionCount()).isEqualTo(1);
// Count minus duplicate
@@ -105,14 +105,14 @@ class BeanFactoryUtilsTests {
}
@Test
void testHierarchicalNamesWithNoMatch() {
void hierarchicalNamesWithNoMatch() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, NoOp.class));
assertThat(names).isEmpty();
}
@Test
void testHierarchicalNamesWithMatchOnlyInRoot() {
void hierarchicalNamesWithMatchOnlyInRoot() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, IndexedTestBean.class));
assertThat(names).hasSize(1);
@@ -122,7 +122,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testGetBeanNamesForTypeWithOverride() {
void getBeanNamesForTypeWithOverride() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, ITestBean.class));
// includes 2 TestBeans from FactoryBeans (DummyFactory definitions)
@@ -134,7 +134,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testNoBeansOfType() {
void noBeansOfType() {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
lbf.addBean("foo", new Object());
Map<String, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, false);
@@ -142,7 +142,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testFindsBeansOfTypeWithStaticFactory() {
void findsBeansOfTypeWithStaticFactory() {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
TestBean t1 = new TestBean();
TestBean t2 = new TestBean();
@@ -173,7 +173,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testFindsBeansOfTypeWithDefaultFactory() {
void findsBeansOfTypeWithDefaultFactory() {
Object test3 = this.listableBeanFactory.getBean("test3");
Object test = this.listableBeanFactory.getBean("test");
@@ -236,7 +236,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testHierarchicalResolutionWithOverride() {
void hierarchicalResolutionWithOverride() {
Object test3 = this.listableBeanFactory.getBean("test3");
Object test = this.listableBeanFactory.getBean("test");
@@ -275,14 +275,14 @@ class BeanFactoryUtilsTests {
}
@Test
void testHierarchicalNamesForAnnotationWithNoMatch() {
void hierarchicalNamesForAnnotationWithNoMatch() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForAnnotationIncludingAncestors(this.listableBeanFactory, Override.class));
assertThat(names).isEmpty();
}
@Test
void testHierarchicalNamesForAnnotationWithMatchOnlyInRoot() {
void hierarchicalNamesForAnnotationWithMatchOnlyInRoot() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForAnnotationIncludingAncestors(this.listableBeanFactory, TestAnnotation.class));
assertThat(names).hasSize(1);
@@ -292,7 +292,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testGetBeanNamesForAnnotationWithOverride() {
void getBeanNamesForAnnotationWithOverride() {
AnnotatedBean annotatedBean = new AnnotatedBean();
this.listableBeanFactory.registerSingleton("anotherAnnotatedBean", annotatedBean);
List<String> names = Arrays.asList(
@@ -303,25 +303,25 @@ class BeanFactoryUtilsTests {
}
@Test
void testADependencies() {
void aDependencies() {
String[] deps = this.dependentBeansFactory.getDependentBeans("a");
assertThat(ObjectUtils.isEmpty(deps)).isTrue();
}
@Test
void testBDependencies() {
void bDependencies() {
String[] deps = this.dependentBeansFactory.getDependentBeans("b");
assertThat(Arrays.equals(new String[] { "c" }, deps)).isTrue();
}
@Test
void testCDependencies() {
void cDependencies() {
String[] deps = this.dependentBeansFactory.getDependentBeans("c");
assertThat(Arrays.equals(new String[] { "int", "long" }, deps)).isTrue();
}
@Test
void testIntDependencies() {
void intDependencies() {
String[] deps = this.dependentBeansFactory.getDependentBeans("int");
assertThat(Arrays.equals(new String[] { "buffer" }, deps)).isTrue();
}
@@ -334,7 +334,7 @@ class BeanFactoryUtilsTests {
}
@Test // gh-25520
public void findAnnotationOnBeanWithStaticFactory() {
void findAnnotationOnBeanWithStaticFactory() {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
lbf.addBean("controllerAdvice", new ControllerAdviceClass());
lbf.addBean("restControllerAdvice", new RestControllerAdviceClass());
@@ -401,7 +401,7 @@ class BeanFactoryUtilsTests {
testIsSingletonAndIsPrototype(lbf);
}
void testIsSingletonAndIsPrototype(ListableBeanFactory lbf) {
private static void testIsSingletonAndIsPrototype(ListableBeanFactory lbf) {
Map<String, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class);
assertThat(beans).hasSize(7);
assertThat(beans.get("bean")).isSameAs(lbf.getBean("bean"));
@@ -520,7 +520,7 @@ class BeanFactoryUtilsTests {
testSupportsMultipleTypes(lbf);
}
void testSupportsMultipleTypes(ListableBeanFactory lbf) {
private static void testSupportsMultipleTypes(ListableBeanFactory lbf) {
List<ITestBean> testBeanList = lbf.getBeanProvider(ITestBean.class).stream().toList();
assertThat(testBeanList).hasSize(5);
assertThat(testBeanList.get(0)).isSameAs(lbf.getBean("bean", TestBean.class));
@@ -48,7 +48,7 @@ class FactoryBeanTests {
@Test
void testFactoryBeanReturnsNull() {
void factoryBeanReturnsNull() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(RETURNS_NULL_CONTEXT);
@@ -56,7 +56,7 @@ class FactoryBeanTests {
}
@Test
void testFactoryBeansWithAutowiring() {
void factoryBeansWithAutowiring() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
@@ -77,7 +77,7 @@ class FactoryBeanTests {
}
@Test
void testFactoryBeansWithIntermediateFactoryBeanAutowiringFailure() {
void factoryBeansWithIntermediateFactoryBeanAutowiringFailure() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
@@ -92,21 +92,21 @@ class FactoryBeanTests {
}
@Test
void testAbstractFactoryBeanViaAnnotation() {
void abstractFactoryBeanViaAnnotation() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(ABSTRACT_CONTEXT);
factory.getBeansWithAnnotation(Component.class);
}
@Test
void testAbstractFactoryBeanViaType() {
void abstractFactoryBeanViaType() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(ABSTRACT_CONTEXT);
factory.getBeansOfType(AbstractFactoryBean.class);
}
@Test
void testCircularReferenceWithPostProcessor() {
void circularReferenceWithPostProcessor() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(CIRCULAR_CONTEXT);
@@ -30,27 +30,27 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class AnnotationBeanWiringInfoResolverTests {
@Test
void testResolveWiringInfo() {
void resolveWiringInfo() {
assertThatIllegalArgumentException().isThrownBy(() ->
new AnnotationBeanWiringInfoResolver().resolveWiringInfo(null));
}
@Test
void testResolveWiringInfoWithAnInstanceOfANonAnnotatedClass() {
void resolveWiringInfoWithAnInstanceOfANonAnnotatedClass() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo("java.lang.String is not @Configurable");
assertThat(info).as("Must be returning null for a non-@Configurable class instance").isNull();
}
@Test
void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClass() {
void resolveWiringInfoWithAnInstanceOfAnAnnotatedClass() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new Soap());
assertThat(info).as("Must *not* be returning null for a non-@Configurable class instance").isNotNull();
}
@Test
void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitly() {
void resolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitly() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new WirelessSoap());
assertThat(info).as("Must *not* be returning null for an @Configurable class instance even when autowiring is NO").isNotNull();
@@ -59,7 +59,7 @@ class AnnotationBeanWiringInfoResolverTests {
}
@Test
void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitlyAndCustomBeanName() {
void resolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitlyAndCustomBeanName() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new NamedWirelessSoap());
assertThat(info).as("Must *not* be returning null for an @Configurable class instance even when autowiring is NO").isNotNull();
@@ -37,7 +37,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
class CustomAutowireConfigurerTests {
@Test
void testCustomResolver() {
void customResolver() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
qualifiedResource(CustomAutowireConfigurerTests.class, "context.xml"));
@@ -80,7 +80,7 @@ class InjectAnnotationBeanPostProcessorTests {
@Test
void testIncompleteBeanDefinition() {
void incompleteBeanDefinition() {
bf.registerBeanDefinition("testBean", new GenericBeanDefinition());
try {
bf.getBean("testBean");
@@ -91,7 +91,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testResourceInjection() {
void resourceInjection() {
RootBeanDefinition bd = new RootBeanDefinition(ResourceInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@@ -108,7 +108,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testExtendedResourceInjection() {
void extendedResourceInjection() {
RootBeanDefinition bd = new RootBeanDefinition(TypedExtendedResourceInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@@ -135,7 +135,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testExtendedResourceInjectionWithOverriding() {
void extendedResourceInjectionWithOverriding() {
RootBeanDefinition annotatedBd = new RootBeanDefinition(TypedExtendedResourceInjectionBean.class);
TestBean tb2 = new TestBean();
annotatedBd.getPropertyValues().add("testBean2", tb2);
@@ -155,7 +155,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testConstructorResourceInjection() {
void constructorResourceInjection() {
RootBeanDefinition bd = new RootBeanDefinition(ConstructorResourceInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@@ -182,7 +182,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testConstructorResourceInjectionWithMultipleCandidatesAsCollection() {
void constructorResourceInjectionWithMultipleCandidatesAsCollection() {
bf.registerBeanDefinition("annotatedBean",
new RootBeanDefinition(ConstructorsCollectionResourceInjectionBean.class));
TestBean tb = new TestBean();
@@ -199,7 +199,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testConstructorResourceInjectionWithMultipleCandidatesAndFallback() {
void constructorResourceInjectionWithMultipleCandidatesAndFallback() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ConstructorsResourceInjectionBean.class));
TestBean tb = new TestBean();
bf.registerSingleton("testBean", tb);
@@ -210,7 +210,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testConstructorInjectionWithMap() {
void constructorInjectionWithMap() {
RootBeanDefinition bd = new RootBeanDefinition(MapConstructorInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@@ -235,7 +235,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testFieldInjectionWithMap() {
void fieldInjectionWithMap() {
RootBeanDefinition bd = new RootBeanDefinition(MapFieldInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@@ -260,7 +260,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testMethodInjectionWithMap() {
void methodInjectionWithMap() {
RootBeanDefinition bd = new RootBeanDefinition(MapMethodInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@@ -281,7 +281,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testMethodInjectionWithMapAndMultipleMatches() {
void methodInjectionWithMapAndMultipleMatches() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(MapMethodInjectionBean.class));
bf.registerBeanDefinition("testBean1", new RootBeanDefinition(TestBean.class));
bf.registerBeanDefinition("testBean2", new RootBeanDefinition(TestBean.class));
@@ -290,7 +290,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testMethodInjectionWithMapAndMultipleMatchesButOnlyOneAutowireCandidate() {
void methodInjectionWithMapAndMultipleMatchesButOnlyOneAutowireCandidate() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(MapMethodInjectionBean.class));
bf.registerBeanDefinition("testBean1", new RootBeanDefinition(TestBean.class));
RootBeanDefinition rbd2 = new RootBeanDefinition(TestBean.class);
@@ -306,7 +306,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryInjection() {
void objectFactoryInjection() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryQualifierFieldInjectionBean.class));
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
bd.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "testBean"));
@@ -318,7 +318,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryQualifierInjection() {
void objectFactoryQualifierInjection() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryQualifierFieldInjectionBean.class));
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
bd.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "testBean"));
@@ -329,7 +329,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryFieldInjectionIntoPrototypeBean() {
void objectFactoryFieldInjectionIntoPrototypeBean() {
RootBeanDefinition annotatedBeanDefinition = new RootBeanDefinition(ObjectFactoryQualifierFieldInjectionBean.class);
annotatedBeanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", annotatedBeanDefinition);
@@ -346,7 +346,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryMethodInjectionIntoPrototypeBean() {
void objectFactoryMethodInjectionIntoPrototypeBean() {
RootBeanDefinition annotatedBeanDefinition = new RootBeanDefinition(ObjectFactoryQualifierMethodInjectionBean.class);
annotatedBeanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", annotatedBeanDefinition);
@@ -363,7 +363,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithBeanField() throws Exception {
void objectFactoryWithBeanField() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@@ -377,7 +377,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithBeanFieldAgainstFrozen() throws Exception {
void objectFactoryWithBeanFieldAgainstFrozen() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@@ -392,7 +392,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithBeanMethod() throws Exception {
void objectFactoryWithBeanMethod() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@@ -406,7 +406,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithBeanMethodAgainstFrozen() throws Exception {
void objectFactoryWithBeanMethodAgainstFrozen() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@@ -421,7 +421,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithTypedListField() throws Exception {
void objectFactoryWithTypedListField() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryListFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@@ -433,7 +433,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithTypedListMethod() throws Exception {
void objectFactoryWithTypedListMethod() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryListMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@@ -445,7 +445,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithTypedMapField() throws Exception {
void objectFactoryWithTypedMapField() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryMapFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@@ -457,7 +457,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithTypedMapMethod() throws Exception {
void objectFactoryWithTypedMapMethod() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryMapMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@@ -474,7 +474,7 @@ class InjectAnnotationBeanPostProcessorTests {
* specifically addressing SPR-4040.
*/
@Test
void testBeanAutowiredWithFactoryBean() {
void beanAutowiredWithFactoryBean() {
bf.registerBeanDefinition("factoryBeanDependentBean", new RootBeanDefinition(FactoryBeanDependentBean.class));
bf.registerSingleton("stringFactoryBean", new StringFactoryBean());
@@ -487,7 +487,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testNullableFieldInjectionWithBeanAvailable() {
void nullableFieldInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(NullableFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@@ -497,7 +497,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testNullableFieldInjectionWithBeanNotAvailable() {
void nullableFieldInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(NullableFieldInjectionBean.class));
NullableFieldInjectionBean bean = (NullableFieldInjectionBean) bf.getBean("annotatedBean");
@@ -505,7 +505,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testNullableMethodInjectionWithBeanAvailable() {
void nullableMethodInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(NullableMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@@ -515,7 +515,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testNullableMethodInjectionWithBeanNotAvailable() {
void nullableMethodInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(NullableMethodInjectionBean.class));
NullableMethodInjectionBean bean = (NullableMethodInjectionBean) bf.getBean("annotatedBean");
@@ -523,7 +523,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalFieldInjectionWithBeanAvailable() {
void optionalFieldInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@@ -534,7 +534,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalFieldInjectionWithBeanNotAvailable() {
void optionalFieldInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalFieldInjectionBean.class));
OptionalFieldInjectionBean bean = (OptionalFieldInjectionBean) bf.getBean("annotatedBean");
@@ -542,7 +542,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalMethodInjectionWithBeanAvailable() {
void optionalMethodInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@@ -553,7 +553,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalMethodInjectionWithBeanNotAvailable() {
void optionalMethodInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalMethodInjectionBean.class));
OptionalMethodInjectionBean bean = (OptionalMethodInjectionBean) bf.getBean("annotatedBean");
@@ -561,7 +561,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalListFieldInjectionWithBeanAvailable() {
void optionalListFieldInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalListFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@@ -572,7 +572,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalListFieldInjectionWithBeanNotAvailable() {
void optionalListFieldInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalListFieldInjectionBean.class));
OptionalListFieldInjectionBean bean = (OptionalListFieldInjectionBean) bf.getBean("annotatedBean");
@@ -580,7 +580,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalListMethodInjectionWithBeanAvailable() {
void optionalListMethodInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalListMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@@ -591,7 +591,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalListMethodInjectionWithBeanNotAvailable() {
void optionalListMethodInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalListMethodInjectionBean.class));
OptionalListMethodInjectionBean bean = (OptionalListMethodInjectionBean) bf.getBean("annotatedBean");
@@ -599,7 +599,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testProviderOfOptionalFieldInjectionWithBeanAvailable() {
void providerOfOptionalFieldInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ProviderOfOptionalFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@@ -610,7 +610,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testProviderOfOptionalFieldInjectionWithBeanNotAvailable() {
void providerOfOptionalFieldInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ProviderOfOptionalFieldInjectionBean.class));
ProviderOfOptionalFieldInjectionBean bean = (ProviderOfOptionalFieldInjectionBean) bf.getBean("annotatedBean");
@@ -618,7 +618,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testProviderOfOptionalMethodInjectionWithBeanAvailable() {
void providerOfOptionalMethodInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ProviderOfOptionalMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@@ -629,7 +629,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testProviderOfOptionalMethodInjectionWithBeanNotAvailable() {
void providerOfOptionalMethodInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ProviderOfOptionalMethodInjectionBean.class));
ProviderOfOptionalMethodInjectionBean bean = (ProviderOfOptionalMethodInjectionBean) bf.getBean("annotatedBean");
@@ -637,7 +637,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testAnnotatedDefaultConstructor() {
void annotatedDefaultConstructor() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(AnnotatedDefaultConstructorBean.class));
assertThat(bf.getBean("annotatedBean")).isNotNull();
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class LookupAnnotationTests {
@Test
void testWithoutConstructorArg() {
void withoutConstructorArg() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
Object expected = bean.get();
@@ -42,7 +42,7 @@ class LookupAnnotationTests {
}
@Test
void testWithOverloadedArg() {
void withOverloadedArg() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
TestBean expected = bean.get("haha");
@@ -52,7 +52,7 @@ class LookupAnnotationTests {
}
@Test
void testWithOneConstructorArg() {
void withOneConstructorArg() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
TestBean expected = bean.getOneArgument("haha");
@@ -62,7 +62,7 @@ class LookupAnnotationTests {
}
@Test
void testWithTwoConstructorArg() {
void withTwoConstructorArg() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
TestBean expected = bean.getTwoArguments("haha", 72);
@@ -73,7 +73,7 @@ class LookupAnnotationTests {
}
@Test
void testWithThreeArgsShouldFail() {
void withThreeArgsShouldFail() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThatExceptionOfType(AbstractMethodError.class).as("TestBean has no three arg constructor").isThrownBy(() ->
@@ -82,7 +82,7 @@ class LookupAnnotationTests {
}
@Test
void testWithEarlyInjection() {
void withEarlyInjection() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = beanFactory.getBean("beanConsumer", BeanConsumer.class).abstractBean;
Object expected = bean.get();
@@ -91,7 +91,7 @@ class LookupAnnotationTests {
}
@Test // gh-25806
public void testWithNullBean() {
void withNullBean() {
RootBeanDefinition tbd = new RootBeanDefinition(TestBean.class, () -> null);
tbd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
DefaultListableBeanFactory beanFactory = configureBeanFactory(tbd);
@@ -103,7 +103,7 @@ class LookupAnnotationTests {
}
@Test
void testWithGenericBean() {
void withGenericBean() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
beanFactory.registerBeanDefinition("numberBean", new RootBeanDefinition(NumberBean.class));
beanFactory.registerBeanDefinition("doubleStore", new RootBeanDefinition(DoubleStore.class));
@@ -115,7 +115,7 @@ class LookupAnnotationTests {
}
@Test
void testSingletonWithoutMetadataCaching() {
void singletonWithoutMetadataCaching() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
beanFactory.setCacheBeanMetadata(false);
@@ -129,7 +129,7 @@ class LookupAnnotationTests {
}
@Test
void testPrototypeWithoutMetadataCaching() {
void prototypeWithoutMetadataCaching() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
beanFactory.setCacheBeanMetadata(false);
@@ -67,7 +67,7 @@ class DefaultBeanRegistrationCodeFragmentsTests {
private final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
@Test
public void getTargetWithInstanceSupplier() {
void getTargetWithInstanceSupplier() {
RootBeanDefinition beanDefinition = new RootBeanDefinition(SimpleBean.class);
beanDefinition.setInstanceSupplier(SimpleBean::new);
RegisteredBean registeredBean = registerTestBean(beanDefinition);
@@ -78,7 +78,7 @@ class DefaultBeanRegistrationCodeFragmentsTests {
}
@Test
public void getTargetWithInstanceSupplierAndResourceDescription() {
void getTargetWithInstanceSupplierAndResourceDescription() {
RootBeanDefinition beanDefinition = new RootBeanDefinition(SimpleBean.class);
beanDefinition.setInstanceSupplier(SimpleBean::new);
beanDefinition.setResourceDescription("my test resource");
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class CustomEditorConfigurerTests {
@Test
void testCustomEditorConfigurerWithPropertyEditorRegistrar() throws ParseException {
void customEditorConfigurerWithPropertyEditorRegistrar() throws ParseException {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CustomEditorConfigurer cec = new CustomEditorConfigurer();
final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
@@ -70,7 +70,7 @@ class CustomEditorConfigurerTests {
}
@Test
void testCustomEditorConfigurerWithEditorAsClass() throws ParseException {
void customEditorConfigurerWithEditorAsClass() throws ParseException {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CustomEditorConfigurer cec = new CustomEditorConfigurer();
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<>();
@@ -90,7 +90,7 @@ class CustomEditorConfigurerTests {
}
@Test
void testCustomEditorConfigurerWithRequiredTypeArray() {
void customEditorConfigurerWithRequiredTypeArray() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CustomEditorConfigurer cec = new CustomEditorConfigurer();
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<>();
@@ -43,13 +43,13 @@ class CustomScopeConfigurerTests {
@Test
void testWithNoScopes() {
void withNoScopes() {
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.postProcessBeanFactory(factory);
}
@Test
void testSunnyDayWithBonaFideScopeInstance() {
void sunnyDayWithBonaFideScopeInstance() {
Scope scope = mock();
factory.registerScope(FOO_SCOPE, scope);
Map<String, Object> scopes = new HashMap<>();
@@ -60,7 +60,7 @@ class CustomScopeConfigurerTests {
}
@Test
void testSunnyDayWithBonaFideScopeClass() {
void sunnyDayWithBonaFideScopeClass() {
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, NoOpScope.class);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@@ -70,7 +70,7 @@ class CustomScopeConfigurerTests {
}
@Test
void testSunnyDayWithBonaFideScopeClassName() {
void sunnyDayWithBonaFideScopeClassName() {
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, NoOpScope.class.getName());
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@@ -80,7 +80,7 @@ class CustomScopeConfigurerTests {
}
@Test
void testWhereScopeMapHasNullScopeValueInEntrySet() {
void whereScopeMapHasNullScopeValueInEntrySet() {
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, null);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@@ -90,7 +90,7 @@ class CustomScopeConfigurerTests {
}
@Test
void testWhereScopeMapHasNonScopeInstanceInEntrySet() {
void whereScopeMapHasNonScopeInstanceInEntrySet() {
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, this); // <-- not a valid value...
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@@ -101,7 +101,7 @@ class CustomScopeConfigurerTests {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
void testWhereScopeMapHasNonStringTypedScopeNameInKeySet() {
void whereScopeMapHasNonStringTypedScopeNameInKeySet() {
Map scopes = new HashMap();
scopes.put(this, new NoOpScope()); // <-- not a valid value (the key)...
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@@ -35,7 +35,7 @@ class DeprecatedBeanWarnerTests {
@Test
@SuppressWarnings("deprecation")
public void postProcess() {
void postProcess() {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
BeanDefinition def = new RootBeanDefinition(MyDeprecatedBean.class);
String beanName = "deprecated";
@@ -37,7 +37,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
class FieldRetrievingFactoryBeanTests {
@Test
void testStaticField() throws Exception {
void staticField() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setStaticField("java.sql.Connection.TRANSACTION_SERIALIZABLE");
fr.afterPropertiesSet();
@@ -45,7 +45,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testStaticFieldWithWhitespace() throws Exception {
void staticFieldWithWhitespace() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setStaticField(" java.sql.Connection.TRANSACTION_SERIALIZABLE ");
fr.afterPropertiesSet();
@@ -53,7 +53,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testStaticFieldViaClassAndFieldName() throws Exception {
void staticFieldViaClassAndFieldName() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setTargetClass(Connection.class);
fr.setTargetField("TRANSACTION_SERIALIZABLE");
@@ -62,7 +62,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testNonStaticField() throws Exception {
void nonStaticField() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
PublicFieldHolder target = new PublicFieldHolder();
fr.setTargetObject(target);
@@ -72,7 +72,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testNothingButBeanName() throws Exception {
void nothingButBeanName() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setBeanName("java.sql.Connection.TRANSACTION_SERIALIZABLE");
fr.afterPropertiesSet();
@@ -80,7 +80,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testJustTargetField() throws Exception {
void justTargetField() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setTargetField("TRANSACTION_SERIALIZABLE");
try {
@@ -91,7 +91,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testJustTargetClass() throws Exception {
void justTargetClass() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setTargetClass(Connection.class);
try {
@@ -102,7 +102,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testJustTargetObject() throws Exception {
void justTargetObject() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setTargetObject(new PublicFieldHolder());
try {
@@ -113,7 +113,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testWithConstantOnClassWithPackageLevelVisibility() throws Exception {
void withConstantOnClassWithPackageLevelVisibility() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setBeanName("org.springframework.beans.testfixture.beans.PackageLevelVisibleBean.CONSTANT");
fr.afterPropertiesSet();
@@ -121,7 +121,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testBeanNameSyntaxWithBeanFactory() {
void beanNameSyntaxWithBeanFactory() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
qualifiedResource(FieldRetrievingFactoryBeanTests.class, "context.xml"));
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class MethodInvokingFactoryBeanTests {
@Test
void testParameterValidation() throws Exception {
void parameterValidation() throws Exception {
// assert that only static OR non-static are set, but not both or none
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
@@ -91,7 +91,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testGetObjectType() throws Exception {
void getObjectType() throws Exception {
TestClass1 tc1 = new TestClass1();
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
mcfb = new MethodInvokingFactoryBean();
@@ -127,7 +127,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testGetObject() throws Exception {
void getObject() throws Exception {
// singleton, non-static
TestClass1 tc1 = new TestClass1();
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
@@ -190,7 +190,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testArgumentConversion() throws Exception {
void argumentConversion() throws Exception {
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
mcfb.setTargetClass(TestClass1.class);
mcfb.setTargetMethod("supertypes");
@@ -224,7 +224,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testInvokeWithNullArgument() throws Exception {
void invokeWithNullArgument() throws Exception {
MethodInvoker methodInvoker = new MethodInvoker();
methodInvoker.setTargetClass(TestClass1.class);
methodInvoker.setTargetMethod("nullArgument");
@@ -234,7 +234,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testInvokeWithIntArgument() throws Exception {
void invokeWithIntArgument() throws Exception {
ArgumentConvertingMethodInvoker methodInvoker = new ArgumentConvertingMethodInvoker();
methodInvoker.setTargetClass(TestClass1.class);
methodInvoker.setTargetMethod("intArgument");
@@ -251,7 +251,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testInvokeWithIntArguments() throws Exception {
void invokeWithIntArguments() throws Exception {
MethodInvokingBean methodInvoker = new MethodInvokingBean();
methodInvoker.setTargetClass(TestClass1.class);
methodInvoker.setTargetMethod("intArguments");
@@ -61,7 +61,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
@Test
void testFactoryOperation() {
void factoryOperation() {
FactoryTestBean testBean = beanFactory.getBean("factoryTestBean", FactoryTestBean.class);
ObjectFactory<?> objectFactory = testBean.getObjectFactory();
@@ -71,7 +71,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testFactorySerialization() throws Exception {
void factorySerialization() throws Exception {
FactoryTestBean testBean = beanFactory.getBean("factoryTestBean", FactoryTestBean.class);
ObjectFactory<?> objectFactory = testBean.getObjectFactory();
@@ -83,7 +83,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testProviderOperation() {
void providerOperation() {
ProviderTestBean testBean = beanFactory.getBean("providerTestBean", ProviderTestBean.class);
Provider<?> provider = testBean.getProvider();
@@ -93,7 +93,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testProviderSerialization() throws Exception {
void providerSerialization() throws Exception {
ProviderTestBean testBean = beanFactory.getBean("providerTestBean", ProviderTestBean.class);
Provider<?> provider = testBean.getProvider();
@@ -105,7 +105,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testDoesNotComplainWhenTargetBeanNameRefersToSingleton() throws Exception {
void doesNotComplainWhenTargetBeanNameRefersToSingleton() throws Exception {
final String targetBeanName = "singleton";
final String expectedSingleton = "Alicia Keys";
@@ -122,14 +122,14 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testWhenTargetBeanNameIsNull() {
void whenTargetBeanNameIsNull() {
assertThatIllegalArgumentException().as(
"'targetBeanName' property not set").isThrownBy(
new ObjectFactoryCreatingFactoryBean()::afterPropertiesSet);
}
@Test
void testWhenTargetBeanNameIsEmptyString() {
void whenTargetBeanNameIsEmptyString() {
ObjectFactoryCreatingFactoryBean factory = new ObjectFactoryCreatingFactoryBean();
factory.setTargetBeanName("");
assertThatIllegalArgumentException().as(
@@ -138,7 +138,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testWhenTargetBeanNameIsWhitespacedString() {
void whenTargetBeanNameIsWhitespacedString() {
ObjectFactoryCreatingFactoryBean factory = new ObjectFactoryCreatingFactoryBean();
factory.setTargetBeanName(" \t");
assertThatIllegalArgumentException().as(
@@ -147,7 +147,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testEnsureOFBFBReportsThatItActuallyCreatesObjectFactoryInstances() {
void ensureOFBFBReportsThatItActuallyCreatesObjectFactoryInstances() {
assertThat(new ObjectFactoryCreatingFactoryBean().getObjectType()).as("Must be reporting that it creates ObjectFactory instances (as per class contract).").isEqualTo(ObjectFactory.class);
}
@@ -39,7 +39,7 @@ class PropertiesFactoryBeanTests {
private static final Resource TEST_PROPS_XML = qualifiedResource(CLASS, "test.properties.xml");
@Test
void testWithPropertiesFile() throws Exception {
void withPropertiesFile() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
pfb.afterPropertiesSet();
@@ -48,7 +48,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPropertiesXmlFile() throws Exception {
void withPropertiesXmlFile() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS_XML);
pfb.afterPropertiesSet();
@@ -57,7 +57,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithLocalProperties() throws Exception {
void withLocalProperties() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
Properties localProps = new Properties();
localProps.setProperty("key2", "value2");
@@ -68,7 +68,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPropertiesFileAndLocalProperties() throws Exception {
void withPropertiesFileAndLocalProperties() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
Properties localProps = new Properties();
@@ -82,7 +82,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPropertiesFileAndMultipleLocalProperties() throws Exception {
void withPropertiesFileAndMultipleLocalProperties() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
@@ -111,7 +111,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPropertiesFileAndLocalPropertiesAndLocalOverride() throws Exception {
void withPropertiesFileAndLocalPropertiesAndLocalOverride() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
Properties localProps = new Properties();
@@ -126,7 +126,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPrototype() throws Exception {
void withPrototype() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setSingleton(false);
pfb.setLocation(TEST_PROPS);
@@ -40,7 +40,7 @@ class PropertyPathFactoryBeanTests {
@Test
void testPropertyPathFactoryBeanWithSingletonResult() {
void propertyPathFactoryBeanWithSingletonResult() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getBean("propertyPath1")).isEqualTo(12);
@@ -55,7 +55,7 @@ class PropertyPathFactoryBeanTests {
}
@Test
void testPropertyPathFactoryBeanWithPrototypeResult() {
void propertyPathFactoryBeanWithPrototypeResult() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getType("tb.spouse")).isNull();
@@ -75,7 +75,7 @@ class PropertyPathFactoryBeanTests {
}
@Test
void testPropertyPathFactoryBeanWithNullResult() {
void propertyPathFactoryBeanWithNullResult() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getType("tb.spouse.spouse")).isNull();
@@ -83,7 +83,7 @@ class PropertyPathFactoryBeanTests {
}
@Test
void testPropertyPathFactoryBeanAsInnerBean() {
void propertyPathFactoryBeanAsInnerBean() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
TestBean spouse = (TestBean) xbf.getBean("otb.spouse");
@@ -94,14 +94,14 @@ class PropertyPathFactoryBeanTests {
}
@Test
void testPropertyPathFactoryBeanAsNullReference() {
void propertyPathFactoryBeanAsNullReference() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getBean("tbWithNullReference", TestBean.class).getSpouse()).isNull();
}
@Test
void testPropertyPathFactoryBeanAsInnerNull() {
void propertyPathFactoryBeanAsInnerNull() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getBean("tbWithInnerNull", TestBean.class).getSpouse()).isNull();
@@ -75,7 +75,7 @@ class PropertyResourceConfigurerTests {
@Test
void testPropertyOverrideConfigurer() {
void propertyOverrideConfigurer() {
BeanDefinition def1 = BeanDefinitionBuilder.genericBeanDefinition(TestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb1", def1);
@@ -115,7 +115,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithNestedProperty() {
void propertyOverrideConfigurerWithNestedProperty() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@@ -133,7 +133,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithNestedPropertyAndDotInBeanName() {
void propertyOverrideConfigurerWithNestedPropertyAndDotInBeanName() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("my.tb", def);
@@ -152,7 +152,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithNestedMapPropertyAndDotInMapKey() {
void propertyOverrideConfigurerWithNestedMapPropertyAndDotInMapKey() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@@ -170,7 +170,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithHeldProperties() {
void propertyOverrideConfigurerWithHeldProperties() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(PropertiesHolder.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@@ -186,7 +186,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithPropertiesFile() {
void propertyOverrideConfigurerWithPropertiesFile() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@@ -200,7 +200,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithInvalidPropertiesFile() {
void propertyOverrideConfigurerWithInvalidPropertiesFile() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@@ -215,7 +215,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithPropertiesXmlFile() {
void propertyOverrideConfigurerWithPropertiesXmlFile() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@@ -229,7 +229,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithConvertProperties() {
void propertyOverrideConfigurerWithConvertProperties() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@@ -246,7 +246,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithInvalidKey() {
void propertyOverrideConfigurerWithInvalidKey() {
factory.registerBeanDefinition("tb1", genericBeanDefinition(TestBean.class).getBeanDefinition());
factory.registerBeanDefinition("tb2", genericBeanDefinition(TestBean.class).getBeanDefinition());
@@ -281,7 +281,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithIgnoreInvalidKeys() {
void propertyOverrideConfigurerWithIgnoreInvalidKeys() {
factory.registerBeanDefinition("tb1", genericBeanDefinition(TestBean.class).getBeanDefinition());
factory.registerBeanDefinition("tb2", genericBeanDefinition(TestBean.class).getBeanDefinition());
@@ -314,12 +314,12 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurer() {
void propertyPlaceholderConfigurer() {
doTestPropertyPlaceholderConfigurer(false);
}
@Test
void testPropertyPlaceholderConfigurerWithParentChildSeparation() {
void propertyPlaceholderConfigurerWithParentChildSeparation() {
doTestPropertyPlaceholderConfigurer(true);
}
@@ -425,7 +425,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithSystemPropertyFallback() {
void propertyPlaceholderConfigurerWithSystemPropertyFallback() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("country", "${os.name}").getBeanDefinition());
@@ -437,7 +437,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithSystemPropertyNotUsed() {
void propertyPlaceholderConfigurerWithSystemPropertyNotUsed() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("country", "${os.name}").getBeanDefinition());
@@ -452,7 +452,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithOverridingSystemProperty() {
void propertyPlaceholderConfigurerWithOverridingSystemProperty() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("country", "${os.name}").getBeanDefinition());
@@ -468,7 +468,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithUnresolvableSystemProperty() {
void propertyPlaceholderConfigurerWithUnresolvableSystemProperty() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${user.dir}").getBeanDefinition());
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
@@ -479,7 +479,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithUnresolvablePlaceholder() {
void propertyPlaceholderConfigurerWithUnresolvablePlaceholder() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${ref}").getBeanDefinition());
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
@@ -489,7 +489,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithIgnoreUnresolvablePlaceholder() {
void propertyPlaceholderConfigurerWithIgnoreUnresolvablePlaceholder() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${ref}").getBeanDefinition());
@@ -502,7 +502,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithEmptyStringAsNull() {
void propertyPlaceholderConfigurerWithEmptyStringAsNull() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "").getBeanDefinition());
@@ -515,7 +515,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithEmptyStringInPlaceholderAsNull() {
void propertyPlaceholderConfigurerWithEmptyStringInPlaceholderAsNull() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${ref}").getBeanDefinition());
@@ -531,7 +531,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithNestedPlaceholderInKey() {
void propertyPlaceholderConfigurerWithNestedPlaceholderInKey() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${my${key}key}").getBeanDefinition());
@@ -547,7 +547,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithPlaceholderInAlias() {
void propertyPlaceholderConfigurerWithPlaceholderInAlias() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class).getBeanDefinition());
factory.registerAlias("tb", "${alias}");
@@ -563,7 +563,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithSelfReferencingPlaceholderInAlias() {
void propertyPlaceholderConfigurerWithSelfReferencingPlaceholderInAlias() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class).getBeanDefinition());
factory.registerAlias("tb", "${alias}");
@@ -579,7 +579,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithCircularReference() {
void propertyPlaceholderConfigurerWithCircularReference() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("age", "${age}")
.addPropertyValue("name", "name${var}")
@@ -596,7 +596,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithDefaultProperties() {
void propertyPlaceholderConfigurerWithDefaultProperties() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${test}").getBeanDefinition());
@@ -611,7 +611,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithInlineDefault() {
void propertyPlaceholderConfigurerWithInlineDefault() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${test:mytest}").getBeanDefinition());
@@ -623,7 +623,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithAliases() {
void propertyPlaceholderConfigurerWithAliases() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${test}").getBeanDefinition());
@@ -647,7 +647,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPreferencesPlaceholderConfigurer() {
void preferencesPlaceholderConfigurer() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${myName}")
.addPropertyValue("age", "${myAge}")
@@ -674,7 +674,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPreferencesPlaceholderConfigurerWithCustomTreePaths() {
void preferencesPlaceholderConfigurerWithCustomTreePaths() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${myName}")
.addPropertyValue("age", "${myAge}")
@@ -703,7 +703,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPreferencesPlaceholderConfigurerWithPathInPlaceholder() {
void preferencesPlaceholderConfigurerWithPathInPlaceholder() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${mypath/myName}")
.addPropertyValue("age", "${myAge}")
@@ -50,7 +50,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testNoArgGetter() {
void noArgGetter() {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
genericBeanDefinition(ServiceLocatorFactoryBean.class)
@@ -63,7 +63,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testErrorOnTooManyOrTooFew() {
void errorOnTooManyOrTooFew() {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("testServiceInstance2", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
@@ -87,7 +87,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testErrorOnTooManyOrTooFewWithCustomServiceLocatorException() {
void errorOnTooManyOrTooFewWithCustomServiceLocatorException() {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("testServiceInstance2", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
@@ -116,7 +116,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testStringArgGetter() throws Exception {
void stringArgGetter() throws Exception {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
genericBeanDefinition(ServiceLocatorFactoryBean.class)
@@ -136,7 +136,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Disabled @Test // worked when using an ApplicationContext (see commented), fails when using BeanFactory
public void testCombinedLocatorInterface() {
void combinedLocatorInterface() {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerAlias("testService", "1");
@@ -169,7 +169,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Disabled @Test // worked when using an ApplicationContext (see commented), fails when using BeanFactory
public void testServiceMappings() {
void serviceMappings() {
bf.registerBeanDefinition("testService1", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("testService2", genericBeanDefinition(ExtendedTestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
@@ -205,13 +205,13 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testNoServiceLocatorInterfaceSupplied() {
void noServiceLocatorInterfaceSupplied() {
assertThatIllegalArgumentException().isThrownBy(
new ServiceLocatorFactoryBean()::afterPropertiesSet);
}
@Test
void testWhenServiceLocatorInterfaceIsNotAnInterfaceType() {
void whenServiceLocatorInterfaceIsNotAnInterfaceType() {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
factory.setServiceLocatorInterface(getClass());
assertThatIllegalArgumentException().isThrownBy(
@@ -220,7 +220,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testWhenServiceLocatorExceptionClassToExceptionTypeWithOnlyNoArgCtor() {
void whenServiceLocatorExceptionClassToExceptionTypeWithOnlyNoArgCtor() {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
assertThatIllegalArgumentException().isThrownBy(() ->
factory.setServiceLocatorExceptionClass(ExceptionClassWithOnlyZeroArgCtor.class));
@@ -229,7 +229,7 @@ class ServiceLocatorFactoryBeanTests {
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testWhenServiceLocatorExceptionClassIsNotAnExceptionSubclass() {
void whenServiceLocatorExceptionClassIsNotAnExceptionSubclass() {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
assertThatIllegalArgumentException().isThrownBy(() ->
factory.setServiceLocatorExceptionClass((Class) getClass()));
@@ -237,7 +237,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testWhenServiceLocatorMethodCalledWithTooManyParameters() {
void whenServiceLocatorMethodCalledWithTooManyParameters() {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
factory.setServiceLocatorInterface(ServiceLocatorInterfaceWithExtraNonCompliantMethod.class);
factory.afterPropertiesSet();
@@ -247,7 +247,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testRequiresListableBeanFactoryAndChokesOnAnythingElse() {
void requiresListableBeanFactoryAndChokesOnAnythingElse() {
BeanFactory beanFactory = mock();
try {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
@@ -73,7 +73,7 @@ class SimpleScopeTests {
@Test
void testCanGetScopedObject() {
void canGetScopedObject() {
TestBean tb1 = (TestBean) beanFactory.getBean("usesScope");
TestBean tb2 = (TestBean) beanFactory.getBean("usesScope");
assertThat(tb2).isNotSameAs(tb1);
@@ -44,14 +44,14 @@ class YamlMapFactoryBeanTests {
@Test
void testSetIgnoreResourceNotFound() {
void setIgnoreResourceNotFound() {
this.factory.setResolutionMethod(YamlMapFactoryBean.ResolutionMethod.OVERRIDE_AND_IGNORE);
this.factory.setResources(new FileSystemResource("non-existent-file.yml"));
assertThat(this.factory.getObject()).isEmpty();
}
@Test
void testSetBarfOnResourceNotFound() {
void setBarfOnResourceNotFound() {
assertThatIllegalStateException().isThrownBy(() -> {
this.factory.setResources(new FileSystemResource("non-existent-file.yml"));
this.factory.getObject().size();
@@ -59,14 +59,14 @@ class YamlMapFactoryBeanTests {
}
@Test
void testGetObject() {
void getObject() {
this.factory.setResources(new ByteArrayResource("foo: bar".getBytes()));
assertThat(this.factory.getObject()).hasSize(1);
}
@SuppressWarnings("unchecked")
@Test
void testOverrideAndRemoveDefaults() {
void overrideAndRemoveDefaults() {
this.factory.setResources(new ByteArrayResource("foo:\n bar: spam".getBytes()),
new ByteArrayResource("foo:\n spam: bar".getBytes()));
@@ -75,7 +75,7 @@ class YamlMapFactoryBeanTests {
}
@Test
void testFirstFound() {
void firstFound() {
this.factory.setResolutionMethod(YamlProcessor.ResolutionMethod.FIRST_FOUND);
this.factory.setResources(new AbstractResource() {
@Override
@@ -92,7 +92,7 @@ class YamlMapFactoryBeanTests {
}
@Test
void testMapWithPeriodsInKey() {
void mapWithPeriodsInKey() {
this.factory.setResources(new ByteArrayResource("foo:\n ? key1.key2\n : value".getBytes()));
Map<String, Object> map = this.factory.getObject();
@@ -107,7 +107,7 @@ class YamlMapFactoryBeanTests {
}
@Test
void testMapWithIntegerValue() {
void mapWithIntegerValue() {
this.factory.setResources(new ByteArrayResource("foo:\n ? key1.key2\n : 3".getBytes()));
Map<String, Object> map = this.factory.getObject();
@@ -122,7 +122,7 @@ class YamlMapFactoryBeanTests {
}
@Test
void testDuplicateKey() {
void duplicateKey() {
this.factory.setResources(new ByteArrayResource("mymap:\n foo: bar\nmymap:\n bar: foo".getBytes()));
assertThatExceptionOfType(DuplicateKeyException.class).isThrownBy(() ->
this.factory.getObject().get("mymap"));
@@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class ConstructorArgumentEntryTests {
@Test
void testCtorBailsOnNegativeCtorIndexArgument() {
void ctorBailsOnNegativeCtorIndexArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new ConstructorArgumentEntry(-1));
}
@@ -53,7 +53,7 @@ class CustomProblemReporterTests {
@Test
void testErrorsAreCollated() {
void errorsAreCollated() {
this.reader.loadBeanDefinitions(qualifiedResource(CustomProblemReporterTests.class, "context.xml"));
assertThat(this.problemReporter.getErrors()).as("Incorrect number of errors collated").hasSize(4);
@@ -35,7 +35,7 @@ import static org.mockito.Mockito.verify;
class FailFastProblemReporterTests {
@Test
void testError() {
void error() {
FailFastProblemReporter reporter = new FailFastProblemReporter();
assertThatExceptionOfType(BeanDefinitionParsingException.class).isThrownBy(() ->
reporter.error(new Problem("VGER", new Location(new DescriptiveResource("here")),
@@ -43,7 +43,7 @@ class FailFastProblemReporterTests {
}
@Test
void testWarn() {
void warn() {
Problem problem = new Problem("VGER", new Location(new DescriptiveResource("here")),
null, new IllegalArgumentException());
@@ -27,14 +27,14 @@ import static org.assertj.core.api.Assertions.assertThat;
class NullSourceExtractorTests {
@Test
void testPassThroughContract() {
void passThroughContract() {
Object source = new Object();
Object extractedSource = new NullSourceExtractor().extractSource(source, null);
assertThat(extractedSource).as("The contract of NullSourceExtractor states that the extraction *always* return null").isNull();
}
@Test
void testPassThroughContractEvenWithNull() {
void passThroughContractEvenWithNull() {
Object extractedSource = new NullSourceExtractor().extractSource(null, null);
assertThat(extractedSource).as("The contract of NullSourceExtractor states that the extraction *always* return null").isNull();
}
@@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class ParseStateTests {
@Test
void testSimple() {
void simple() {
MockEntry entry = new MockEntry();
ParseState parseState = new ParseState();
@@ -39,7 +39,7 @@ class ParseStateTests {
}
@Test
void testNesting() {
void nesting() {
MockEntry one = new MockEntry();
MockEntry two = new MockEntry();
MockEntry three = new MockEntry();
@@ -59,7 +59,7 @@ class ParseStateTests {
}
@Test
void testSnapshot() {
void snapshot() {
MockEntry entry = new MockEntry();
ParseState original = new ParseState();
@@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class PassThroughSourceExtractorTests {
@Test
void testPassThroughContract() {
void passThroughContract() {
Object source = new Object();
Object extractedSource = new PassThroughSourceExtractor().extractSource(source, null);
assertThat(extractedSource).as("The contract of PassThroughSourceExtractor states that the supplied " +
@@ -37,7 +37,7 @@ class PassThroughSourceExtractorTests {
}
@Test
void testPassThroughContractEvenWithNull() {
void passThroughContractEvenWithNull() {
Object extractedSource = new PassThroughSourceExtractor().extractSource(null, null);
assertThat(extractedSource).as("The contract of PassThroughSourceExtractor states that the supplied " +
"source object *must* be returned as-is (even if null)").isNull();
@@ -29,19 +29,19 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class PropertyEntryTests {
@Test
void testCtorBailsOnNullPropertyNameArgument() {
void ctorBailsOnNullPropertyNameArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new PropertyEntry(null));
}
@Test
void testCtorBailsOnEmptyPropertyNameArgument() {
void ctorBailsOnEmptyPropertyNameArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new PropertyEntry(""));
}
@Test
void testCtorBailsOnWhitespacedPropertyNameArgument() {
void ctorBailsOnWhitespacedPropertyNameArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new PropertyEntry("\t "));
}
@@ -42,7 +42,7 @@ class ServiceLoaderTests {
}
@Test
void testServiceLoaderFactoryBean() {
void serviceLoaderFactoryBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition bd = new RootBeanDefinition(ServiceLoaderFactoryBean.class);
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
@@ -52,7 +52,7 @@ class ServiceLoaderTests {
}
@Test
void testServiceFactoryBean() {
void serviceFactoryBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition bd = new RootBeanDefinition(ServiceFactoryBean.class);
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
@@ -61,7 +61,7 @@ class ServiceLoaderTests {
}
@Test
void testServiceListFactoryBean() {
void serviceListFactoryBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition bd = new RootBeanDefinition(ServiceListFactoryBean.class);
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
@@ -44,7 +44,7 @@ class LookupMethodTests {
@Test
void testWithoutConstructorArg() {
void withoutConstructorArg() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
Object expected = bean.get();
@@ -52,7 +52,7 @@ class LookupMethodTests {
}
@Test
void testWithOverloadedArg() {
void withOverloadedArg() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
TestBean expected = bean.get("haha");
@@ -61,7 +61,7 @@ class LookupMethodTests {
}
@Test
void testWithOneConstructorArg() {
void withOneConstructorArg() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
TestBean expected = bean.getOneArgument("haha");
@@ -70,7 +70,7 @@ class LookupMethodTests {
}
@Test
void testWithTwoConstructorArg() {
void withTwoConstructorArg() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
TestBean expected = bean.getTwoArguments("haha", 72);
@@ -80,7 +80,7 @@ class LookupMethodTests {
}
@Test
void testWithThreeArgsShouldFail() {
void withThreeArgsShouldFail() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
assertThatExceptionOfType(AbstractMethodError.class).as("does not have a three arg constructor")
@@ -88,7 +88,7 @@ class LookupMethodTests {
}
@Test
void testWithOverriddenLookupMethod() {
void withOverriddenLookupMethod() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("extendedBean");
assertThat(bean).isNotNull();
TestBean expected = bean.getOneArgument("haha");
@@ -98,7 +98,7 @@ class LookupMethodTests {
}
@Test
void testWithGenericBean() {
void withGenericBean() {
RootBeanDefinition bd = new RootBeanDefinition(NumberBean.class);
bd.getMethodOverrides().addOverride(new LookupOverride("getDoubleStore", null));
bd.getMethodOverrides().addOverride(new LookupOverride("getFloatStore", null));
@@ -34,7 +34,7 @@ class ManagedPropertiesTests {
@Test
@SuppressWarnings("unchecked")
public void mergeSunnyDay() {
void mergeSunnyDay() {
ManagedProperties parent = new ManagedProperties();
parent.setProperty("one", "one");
parent.setProperty("two", "two");
@@ -69,7 +69,7 @@ class ManagedPropertiesTests {
@Test
@SuppressWarnings("unchecked")
public void mergeEmptyChild() {
void mergeEmptyChild() {
ManagedProperties parent = new ManagedProperties();
parent.setProperty("one", "one");
parent.setProperty("two", "two");
@@ -81,7 +81,7 @@ class ManagedPropertiesTests {
@Test
@SuppressWarnings("unchecked")
public void mergeChildValuesOverrideTheParents() {
void mergeChildValuesOverrideTheParents() {
ManagedProperties parent = new ManagedProperties();
parent.setProperty("one", "one");
parent.setProperty("two", "two");
@@ -49,7 +49,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
@Test
void testAutowireCandidateDefaultWithIrrelevantDescriptor() throws Exception {
void autowireCandidateDefaultWithIrrelevantDescriptor() throws Exception {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
RootBeanDefinition rbd = new RootBeanDefinition(Person.class, cavs, null);
@@ -63,7 +63,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateExplicitlyFalseWithIrrelevantDescriptor() throws Exception {
void autowireCandidateExplicitlyFalseWithIrrelevantDescriptor() throws Exception {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
RootBeanDefinition rbd = new RootBeanDefinition(Person.class, cavs, null);
@@ -78,7 +78,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithFieldDescriptor() throws Exception {
void autowireCandidateWithFieldDescriptor() throws Exception {
lbf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver());
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
@@ -104,7 +104,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateExplicitlyFalseWithFieldDescriptor() throws Exception {
void autowireCandidateExplicitlyFalseWithFieldDescriptor() throws Exception {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null);
@@ -123,7 +123,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithShortClassName() throws Exception {
void autowireCandidateWithShortClassName() throws Exception {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null);
@@ -141,7 +141,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithConstructorDescriptor() throws Exception {
void autowireCandidateWithConstructorDescriptor() throws Exception {
lbf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver());
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
@@ -165,7 +165,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithMethodDescriptor() throws Exception {
void autowireCandidateWithMethodDescriptor() throws Exception {
lbf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver());
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
@@ -197,7 +197,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithMultipleCandidatesDescriptor() throws Exception {
void autowireCandidateWithMultipleCandidatesDescriptor() throws Exception {
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
@@ -42,7 +42,7 @@ class CollectionsWithDefaultTypesTests {
}
@Test
void testListHasDefaultType() {
void listHasDefaultType() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
for (Object o : bean.getSomeList()) {
assertThat(o.getClass()).as("Value type is incorrect").isEqualTo(Integer.class);
@@ -50,7 +50,7 @@ class CollectionsWithDefaultTypesTests {
}
@Test
void testSetHasDefaultType() {
void setHasDefaultType() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
for (Object o : bean.getSomeSet()) {
assertThat(o.getClass()).as("Value type is incorrect").isEqualTo(Integer.class);
@@ -58,13 +58,13 @@ class CollectionsWithDefaultTypesTests {
}
@Test
void testMapHasDefaultKeyAndValueType() {
void mapHasDefaultKeyAndValueType() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
assertMap(bean.getSomeMap());
}
@Test
void testMapWithNestedElementsHasDefaultKeyAndValueType() {
void mapWithNestedElementsHasDefaultKeyAndValueType() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean2");
assertMap(bean.getSomeMap());
}
@@ -79,7 +79,7 @@ class CollectionsWithDefaultTypesTests {
@Test
@SuppressWarnings("rawtypes")
public void testBuildCollectionFromMixtureOfReferencesAndValues() {
void buildCollectionFromMixtureOfReferencesAndValues() {
MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble");
assertThat(jumble.getJumble()).as("Expected 3 elements, not " + jumble.getJumble().size()).hasSize(3);
List l = (List) jumble.getJumble();
@@ -31,19 +31,19 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class DelegatingEntityResolverTests {
@Test
void testCtorWhereDtdEntityResolverIsNull() {
void ctorWhereDtdEntityResolverIsNull() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DelegatingEntityResolver(null, new NoOpEntityResolver()));
}
@Test
void testCtorWhereSchemaEntityResolverIsNull() {
void ctorWhereSchemaEntityResolverIsNull() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DelegatingEntityResolver(new NoOpEntityResolver(), null));
}
@Test
void testCtorWhereEntityResolversAreBothNull() {
void ctorWhereEntityResolversAreBothNull() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DelegatingEntityResolver(null, null));
}
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class FactoryMethodTests {
@Test
void testFactoryMethodsSingletonOnTargetClass() {
void factoryMethodsSingletonOnTargetClass() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -73,7 +73,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsWithInvalidDestroyMethod() {
void factoryMethodsWithInvalidDestroyMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -82,7 +82,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsWithNullInstance() {
void factoryMethodsWithNullInstance() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -93,7 +93,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsWithNullValue() {
void factoryMethodsWithNullValue() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -115,7 +115,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsWithAutowire() {
void factoryMethodsWithAutowire() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -127,7 +127,7 @@ class FactoryMethodTests {
}
@Test
void testProtectedFactoryMethod() {
void protectedFactoryMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -137,7 +137,7 @@ class FactoryMethodTests {
}
@Test
void testPrivateFactoryMethod() {
void privateFactoryMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -147,7 +147,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsPrototypeOnTargetClass() {
void factoryMethodsPrototypeOnTargetClass() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -191,7 +191,7 @@ class FactoryMethodTests {
* Tests where the static factory method is on a different class.
*/
@Test
void testFactoryMethodsOnExternalClass() {
void factoryMethodsOnExternalClass() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -217,7 +217,7 @@ class FactoryMethodTests {
}
@Test
void testInstanceFactoryMethodWithoutArgs() {
void instanceFactoryMethodWithoutArgs() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -235,7 +235,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodNoMatchingStaticMethod() {
void factoryMethodNoMatchingStaticMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -244,7 +244,7 @@ class FactoryMethodTests {
}
@Test
void testNonExistingFactoryMethod() {
void nonExistingFactoryMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -254,7 +254,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodArgumentsForNonExistingMethod() {
void factoryMethodArgumentsForNonExistingMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -264,7 +264,7 @@ class FactoryMethodTests {
}
@Test
void testCanSpecifyFactoryMethodArgumentsOnFactoryMethodPrototype() {
void canSpecifyFactoryMethodArgumentsOnFactoryMethodPrototype() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -300,7 +300,7 @@ class FactoryMethodTests {
}
@Test
void testCanSpecifyFactoryMethodArgumentsOnSingleton() {
void canSpecifyFactoryMethodArgumentsOnSingleton() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -315,7 +315,7 @@ class FactoryMethodTests {
}
@Test
void testCannotSpecifyFactoryMethodArgumentsOnSingletonAfterCreation() {
void cannotSpecifyFactoryMethodArgumentsOnSingletonAfterCreation() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -329,7 +329,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodWithDifferentReturnType() {
void factoryMethodWithDifferentReturnType() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -352,7 +352,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodForJavaMailSession() {
void factoryMethodForJavaMailSession() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@@ -371,7 +371,7 @@ class MailSession {
private MailSession() {
}
public void setProperties(Properties props) {
void setProperties(Properties props) {
this.props = props;
}
@@ -61,13 +61,13 @@ class ProfileXmlBeanDefinitionTests {
private static final String TARGET_BEAN = "foo";
@Test
void testProfileValidation() {
void profileValidation() {
assertThatIllegalArgumentException().isThrownBy(() ->
beanFactoryFor(PROD_ELIGIBLE_XML, NULL_ACTIVE));
}
@Test
void testProfilePermutations() {
void profilePermutations() {
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, NONE_ACTIVE)).isNot(containingTarget());
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, DEV_ACTIVE)).isNot(containingTarget());
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, PROD_ACTIVE)).is(containingTarget());
@@ -116,7 +116,7 @@ class ProfileXmlBeanDefinitionTests {
}
@Test
void testDefaultProfile() {
void defaultProfile() {
{
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
@@ -140,7 +140,7 @@ class ProfileXmlBeanDefinitionTests {
}
@Test
void testDefaultAndNonDefaultProfile() {
void defaultAndNonDefaultProfile() {
assertThat(beanFactoryFor(DEFAULT_ELIGIBLE_XML, NONE_ACTIVE)).is(containingTarget());
assertThat(beanFactoryFor(DEFAULT_ELIGIBLE_XML, "other")).isNot(containingTarget());
@@ -64,19 +64,19 @@ class UtilNamespaceHandlerTests {
@Test
void testConstant() {
void constant() {
Integer min = (Integer) this.beanFactory.getBean("min");
assertThat(min).isEqualTo(Integer.MIN_VALUE);
}
@Test
void testConstantWithDefaultName() {
void constantWithDefaultName() {
Integer max = (Integer) this.beanFactory.getBean("java.lang.Integer.MAX_VALUE");
assertThat(max).isEqualTo(Integer.MAX_VALUE);
}
@Test
void testEvents() {
void events() {
ComponentDefinition propertiesComponent = this.listener.getComponentDefinition("myProperties");
assertThat(propertiesComponent).as("Event for 'myProperties' not sent").isNotNull();
AbstractBeanDefinition propertiesBean = (AbstractBeanDefinition) propertiesComponent.getBeanDefinitions()[0];
@@ -89,26 +89,26 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedProperties() {
void nestedProperties() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
Properties props = bean.getSomeProperties();
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
}
@Test
void testPropertyPath() {
void propertyPath() {
String name = (String) this.beanFactory.getBean("name");
assertThat(name).isEqualTo("Rob Harrop");
}
@Test
void testNestedPropertyPath() {
void nestedPropertyPath() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
assertThat(bean.getName()).isEqualTo("Rob Harrop");
}
@Test
void testSimpleMap() {
void simpleMap() {
Map<?, ?> map = (Map<?, ?>) this.beanFactory.getBean("simpleMap");
assertThat(map.get("foo")).isEqualTo("bar");
Map<?, ?> map2 = (Map<?, ?>) this.beanFactory.getBean("simpleMap");
@@ -116,7 +116,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testScopedMap() {
void scopedMap() {
Map<?, ?> map = (Map<?, ?>) this.beanFactory.getBean("scopedMap");
assertThat(map.get("foo")).isEqualTo("bar");
Map<?, ?> map2 = (Map<?, ?>) this.beanFactory.getBean("scopedMap");
@@ -125,7 +125,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testSimpleList() {
void simpleList() {
assertThat(this.beanFactory.getBean("simpleList"))
.asInstanceOf(InstanceOfAssertFactories.LIST).element(0).isEqualTo("Rob Harrop");
assertThat(this.beanFactory.getBean("simpleList"))
@@ -133,7 +133,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testScopedList() {
void scopedList() {
assertThat(this.beanFactory.getBean("scopedList"))
.asInstanceOf(InstanceOfAssertFactories.LIST).element(0).isEqualTo("Rob Harrop");
assertThat(this.beanFactory.getBean("scopedList"))
@@ -143,7 +143,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testSimpleSet() {
void simpleSet() {
assertThat(this.beanFactory.getBean("simpleSet")).isInstanceOf(Set.class)
.asInstanceOf(InstanceOfAssertFactories.collection(String.class))
.containsOnly("Rob Harrop");
@@ -152,7 +152,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testScopedSet() {
void scopedSet() {
assertThat(this.beanFactory.getBean("scopedSet")).isInstanceOf(Set.class)
.asInstanceOf(InstanceOfAssertFactories.collection(String.class))
.containsOnly("Rob Harrop");
@@ -164,7 +164,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testMapWithRef() throws Exception {
void mapWithRef() throws Exception {
Map<?, ?> map = (Map<?, ?>) this.beanFactory.getBean("mapWithRef");
assertThat(map).isInstanceOf(TreeMap.class);
assertThat(map.get("bean")).isEqualTo(this.beanFactory.getBean("testBean"));
@@ -174,7 +174,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testMapWithTypes() throws Exception {
void mapWithTypes() throws Exception {
Map<?, ?> map = (Map<?, ?>) this.beanFactory.getBean("mapWithTypes");
assertThat(map).isInstanceOf(LinkedCaseInsensitiveMap.class);
assertThat(map.get("bean")).isEqualTo(this.beanFactory.getBean("testBean"));
@@ -184,7 +184,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedCollections() {
void nestedCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("nestedCollectionsBean");
assertThat(bean.getSomeList()).singleElement().isEqualTo("foo");
@@ -205,7 +205,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedShortcutCollections() {
void nestedShortcutCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("nestedShortcutCollections");
assertThat(bean.getStringArray()).containsExactly("fooStr");
@@ -222,7 +222,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedInCollections() {
void nestedInCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("nestedCustomTagBean");
assertThat(bean.getSomeList()).singleElement().isEqualTo(Integer.MIN_VALUE);
@@ -243,7 +243,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testCircularCollections() {
void circularCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionsBean");
assertThat(bean.getSomeList()).singleElement().isSameAs(bean);
@@ -255,7 +255,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testCircularCollectionBeansStartingWithList() {
void circularCollectionBeansStartingWithList() {
this.beanFactory.getBean("circularList");
TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");
@@ -276,7 +276,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testCircularCollectionBeansStartingWithSet() {
void circularCollectionBeansStartingWithSet() {
this.beanFactory.getBean("circularSet");
TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");
@@ -297,7 +297,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testCircularCollectionBeansStartingWithMap() {
void circularCollectionBeansStartingWithMap() {
this.beanFactory.getBean("circularMap");
TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");
@@ -318,13 +318,13 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedInConstructor() {
void nestedInConstructor() {
TestBean bean = (TestBean) this.beanFactory.getBean("constructedTestBean");
assertThat(bean.getName()).isEqualTo("Rob Harrop");
}
@Test
void testLoadProperties() {
void loadProperties() {
Properties props = (Properties) this.beanFactory.getBean("myProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").doesNotContainKey("foo2");
@@ -333,7 +333,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testScopedProperties() {
void scopedProperties() {
Properties props = (Properties) this.beanFactory.getBean("myScopedProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").doesNotContainKey("foo2");
@@ -344,35 +344,35 @@ class UtilNamespaceHandlerTests {
}
@Test
void testLocalProperties() {
void localProperties() {
Properties props = (Properties) this.beanFactory.getBean("myLocalProperties");
assertThat(props).as("Incorrect property value").doesNotContainKey("foo");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "bar2");
}
@Test
void testMergedProperties() {
void mergedProperties() {
Properties props = (Properties) this.beanFactory.getBean("myMergedProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "bar2");
}
@Test
void testLocalOverrideDefault() {
void localOverrideDefault() {
Properties props = (Properties) this.beanFactory.getBean("defaultLocalOverrideProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "local2");
}
@Test
void testLocalOverrideFalse() {
void localOverrideFalse() {
Properties props = (Properties) this.beanFactory.getBean("falseLocalOverrideProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "local2");
}
@Test
void testLocalOverrideTrue() {
void localOverrideTrue() {
Properties props = (Properties) this.beanFactory.getBean("trueLocalOverrideProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "local");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "local2");
@@ -67,7 +67,7 @@ class XmlBeanCollectionTests {
@Test
void testCollectionFactoryDefaults() throws Exception {
void collectionFactoryDefaults() throws Exception {
ListFactoryBean listFactory = new ListFactoryBean();
listFactory.setSourceList(new LinkedList());
listFactory.afterPropertiesSet();
@@ -85,7 +85,7 @@ class XmlBeanCollectionTests {
}
@Test
void testRefSubelement() {
void refSubelement() {
//assertTrue("5 beans in reftypes, not " + this.beanFactory.getBeanDefinitionCount(), this.beanFactory.getBeanDefinitionCount() == 5);
TestBean jen = (TestBean) this.beanFactory.getBean("jenny");
TestBean dave = (TestBean) this.beanFactory.getBean("david");
@@ -93,25 +93,25 @@ class XmlBeanCollectionTests {
}
@Test
void testPropertyWithLiteralValueSubelement() {
void propertyWithLiteralValueSubelement() {
TestBean verbose = (TestBean) this.beanFactory.getBean("verbose");
assertThat(verbose.getName()).isEqualTo("verbose");
}
@Test
void testPropertyWithIdRefLocalAttrSubelement() {
void propertyWithIdRefLocalAttrSubelement() {
TestBean verbose = (TestBean) this.beanFactory.getBean("verbose2");
assertThat(verbose.getName()).isEqualTo("verbose");
}
@Test
void testPropertyWithIdRefBeanAttrSubelement() {
void propertyWithIdRefBeanAttrSubelement() {
TestBean verbose = (TestBean) this.beanFactory.getBean("verbose3");
assertThat(verbose.getName()).isEqualTo("verbose");
}
@Test
void testRefSubelementsBuildCollection() {
void refSubelementsBuildCollection() {
TestBean jen = (TestBean) this.beanFactory.getBean("jenny");
TestBean dave = (TestBean) this.beanFactory.getBean("david");
TestBean rod = (TestBean) this.beanFactory.getBean("rod");
@@ -128,7 +128,7 @@ class XmlBeanCollectionTests {
}
@Test
void testRefSubelementsBuildCollectionWithPrototypes() {
void refSubelementsBuildCollectionWithPrototypes() {
TestBean jen = (TestBean) this.beanFactory.getBean("pJenny");
TestBean dave = (TestBean) this.beanFactory.getBean("pDavid");
TestBean rod = (TestBean) this.beanFactory.getBean("pRod");
@@ -151,14 +151,14 @@ class XmlBeanCollectionTests {
}
@Test
void testRefSubelementsBuildCollectionFromSingleElement() {
void refSubelementsBuildCollectionFromSingleElement() {
TestBean loner = (TestBean) this.beanFactory.getBean("loner");
TestBean dave = (TestBean) this.beanFactory.getBean("david");
assertThat(loner.getFriends()).containsOnly(dave);
}
@Test
void testBuildCollectionFromMixtureOfReferencesAndValues() {
void buildCollectionFromMixtureOfReferencesAndValues() {
MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble");
assertThat(jumble.getJumble()).as("Expected 5 elements, not " + jumble.getJumble()).hasSize(5);
List l = (List) jumble.getJumble();
@@ -172,7 +172,7 @@ class XmlBeanCollectionTests {
}
@Test
void testInvalidBeanNameReference() {
void invalidBeanNameReference() {
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() ->
this.beanFactory.getBean("jumble2"))
.withCauseInstanceOf(BeanDefinitionStoreException.class)
@@ -180,13 +180,13 @@ class XmlBeanCollectionTests {
}
@Test
void testEmptyMap() {
void emptyMap() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("emptyMap");
assertThat(hasMap.getMap()).hasSize(0);
}
@Test
void testMapWithLiteralsOnly() {
void mapWithLiteralsOnly() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("literalMap");
assertThat(hasMap.getMap()).hasSize(3);
assertThat(hasMap.getMap().get("foo").equals("bar")).isTrue();
@@ -195,7 +195,7 @@ class XmlBeanCollectionTests {
}
@Test
void testMapWithLiteralsAndReferences() {
void mapWithLiteralsAndReferences() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("mixedMap");
assertThat(hasMap.getMap()).hasSize(5);
assertThat(hasMap.getMap().get("foo")).isEqualTo(10);
@@ -209,7 +209,7 @@ class XmlBeanCollectionTests {
}
@Test
void testMapWithLiteralsAndPrototypeReferences() {
void mapWithLiteralsAndPrototypeReferences() {
TestBean jenny = (TestBean) this.beanFactory.getBean("pJenny");
HasMap hasMap = (HasMap) this.beanFactory.getBean("pMixedMap");
assertThat(hasMap.getMap()).hasSize(2);
@@ -225,7 +225,7 @@ class XmlBeanCollectionTests {
}
@Test
void testMapWithLiteralsReferencesAndList() {
void mapWithLiteralsReferencesAndList() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("mixedMapWithList");
assertThat(hasMap.getMap()).hasSize(4);
assertThat(hasMap.getMap().get(null).equals("bar")).isTrue();
@@ -262,13 +262,13 @@ class XmlBeanCollectionTests {
}
@Test
void testEmptySet() {
void emptySet() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("emptySet");
assertThat(hasMap.getSet()).hasSize(0);
}
@Test
void testPopulatedSet() {
void populatedSet() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("set");
assertThat(hasMap.getSet()).hasSize(3);
assertThat(hasMap.getSet().contains("bar")).isTrue();
@@ -282,7 +282,7 @@ class XmlBeanCollectionTests {
}
@Test
void testPopulatedConcurrentSet() {
void populatedConcurrentSet() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("concurrentSet");
assertThat(hasMap.getConcurrentSet()).hasSize(3);
assertThat(hasMap.getConcurrentSet().contains("bar")).isTrue();
@@ -292,7 +292,7 @@ class XmlBeanCollectionTests {
}
@Test
void testPopulatedIdentityMap() {
void populatedIdentityMap() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("identityMap");
assertThat(hasMap.getIdentityMap()).hasSize(2);
HashSet set = new HashSet(hasMap.getIdentityMap().keySet());
@@ -301,14 +301,14 @@ class XmlBeanCollectionTests {
}
@Test
void testEmptyProps() {
void emptyProps() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("emptyProps");
assertThat(hasMap.getProps()).hasSize(0);
assertThat(Properties.class).isEqualTo(hasMap.getProps().getClass());
}
@Test
void testPopulatedProps() {
void populatedProps() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
assertThat(hasMap.getProps()).hasSize(2);
assertThat(hasMap.getProps().get("foo").equals("bar")).isTrue();
@@ -316,7 +316,7 @@ class XmlBeanCollectionTests {
}
@Test
void testObjectArray() {
void objectArray() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("objectArray");
assertThat(hasMap.getObjectArray().length).isEqualTo(2);
assertThat(hasMap.getObjectArray()[0].equals("one")).isTrue();
@@ -324,7 +324,7 @@ class XmlBeanCollectionTests {
}
@Test
void testIntegerArray() {
void integerArray() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("integerArray");
assertThat(hasMap.getIntegerArray().length).isEqualTo(3);
assertThat(hasMap.getIntegerArray()[0]).isEqualTo(0);
@@ -333,7 +333,7 @@ class XmlBeanCollectionTests {
}
@Test
void testClassArray() {
void classArray() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("classArray");
assertThat(hasMap.getClassArray().length).isEqualTo(2);
assertThat(hasMap.getClassArray()[0].equals(String.class)).isTrue();
@@ -341,7 +341,7 @@ class XmlBeanCollectionTests {
}
@Test
void testClassList() {
void classList() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("classList");
assertThat(hasMap.getClassList()).hasSize(2);
assertThat(hasMap.getClassList().get(0).equals(String.class)).isTrue();
@@ -349,7 +349,7 @@ class XmlBeanCollectionTests {
}
@Test
void testProps() {
void props() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
assertThat(hasMap.getProps()).hasSize(2);
assertThat(hasMap.getProps().getProperty("foo")).isEqualTo("bar");
@@ -362,45 +362,45 @@ class XmlBeanCollectionTests {
}
@Test
void testListFactory() {
void listFactory() {
List list = (List) this.beanFactory.getBean("listFactory");
assertThat(list).isInstanceOf(LinkedList.class).containsExactly("bar", "jenny");
}
@Test
void testPrototypeListFactory() {
void prototypeListFactory() {
List list = (List) this.beanFactory.getBean("pListFactory");
assertThat(list).isInstanceOf(LinkedList.class).containsExactly("bar", "jenny");
}
@Test
void testSetFactory() {
void setFactory() {
Set set = (Set) this.beanFactory.getBean("setFactory");
assertThat(set).isInstanceOf(TreeSet.class).containsOnly("bar", "jenny");
}
@Test
void testPrototypeSetFactory() {
void prototypeSetFactory() {
Set set = (Set) this.beanFactory.getBean("pSetFactory");
assertThat(set).isInstanceOf(TreeSet.class).containsOnly("bar", "jenny");
}
@Test
void testMapFactory() {
void mapFactory() {
Map map = (Map) this.beanFactory.getBean("mapFactory");
assertThat(map).isInstanceOf(TreeMap.class).containsOnly(
entry("foo", "bar"), entry("jen", "jenny"));
}
@Test
void testPrototypeMapFactory() {
void prototypeMapFactory() {
Map map = (Map) this.beanFactory.getBean("pMapFactory");
assertThat(map).isInstanceOf(TreeMap.class).containsOnly(
entry("foo", "bar"), entry("jen", "jenny"));
}
@Test
void testChoiceBetweenSetAndMap() {
void choiceBetweenSetAndMap() {
MapAndSet sam = (MapAndSet) this.beanFactory.getBean("setAndMap");
assertThat(sam.getObject() instanceof Map).as("Didn't choose constructor with Map argument").isTrue();
Map map = (Map) sam.getObject();
@@ -408,7 +408,7 @@ class XmlBeanCollectionTests {
}
@Test
void testEnumSetFactory() {
void enumSetFactory() {
Set set = (Set) this.beanFactory.getBean("enumSetFactory");
assertThat(set).containsOnly("ONE", "TWO");
}
@@ -100,7 +100,7 @@ class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTests {
@Test
@Override
public void count() {
protected void count() {
assertCount(24);
}
@@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class DefaultNamespaceHandlerResolverTests {
@Test
void testResolvedMappedHandler() {
void resolvedMappedHandler() {
DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader());
NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
assertThat(handler).as("Handler should not be null.").isNotNull();
@@ -42,7 +42,7 @@ class DefaultNamespaceHandlerResolverTests {
}
@Test
void testResolvedMappedHandlerWithNoArgCtor() {
void resolvedMappedHandlerWithNoArgCtor() {
DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver();
NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
assertThat(handler).as("Handler should not be null.").isNotNull();
@@ -50,25 +50,25 @@ class DefaultNamespaceHandlerResolverTests {
}
@Test
void testNonExistentHandlerClass() {
void nonExistentHandlerClass() {
String mappingPath = "org/springframework/beans/factory/xml/support/nonExistent.properties";
new DefaultNamespaceHandlerResolver(getClass().getClassLoader(), mappingPath);
}
@Test
void testCtorWithNullClassLoaderArgument() {
void ctorWithNullClassLoaderArgument() {
// simply must not bail...
new DefaultNamespaceHandlerResolver(null);
}
@Test
void testCtorWithNullClassLoaderArgumentAndNullMappingLocationArgument() {
void ctorWithNullClassLoaderArgumentAndNullMappingLocationArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DefaultNamespaceHandlerResolver(null, null));
}
@Test
void testCtorWithNonExistentMappingLocationArgument() {
void ctorWithNonExistentMappingLocationArgument() {
// simply must not bail; we don't want non-existent resources to result in an Exception
new DefaultNamespaceHandlerResolver(null, "738trbc bobabloobop871");
}
@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class BeanInfoTests {
@Test
void testComplexObject() {
void complexObject() {
ValueBean bean = new ValueBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
Integer value = 1;
@@ -35,27 +35,27 @@ import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
class CustomCollectionEditorTests {
@Test
void testCtorWithNullCollectionType() {
void ctorWithNullCollectionType() {
assertThatIllegalArgumentException().isThrownBy(() ->
new CustomCollectionEditor(null));
}
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testCtorWithNonCollectionType() {
void ctorWithNonCollectionType() {
assertThatIllegalArgumentException().isThrownBy(() ->
new CustomCollectionEditor((Class) String.class));
}
@Test
void testWithCollectionTypeThatDoesNotExposeAPublicNoArgCtor() {
void withCollectionTypeThatDoesNotExposeAPublicNoArgCtor() {
CustomCollectionEditor editor = new CustomCollectionEditor(CollectionTypeWithNoNoArgCtor.class);
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setValue("1"));
}
@Test
void testSunnyDaySetValue() {
void sunnyDaySetValue() {
CustomCollectionEditor editor = new CustomCollectionEditor(ArrayList.class);
editor.setValue(new int[] {0, 1, 2});
Object value = editor.getValue();
@@ -65,7 +65,7 @@ class CustomCollectionEditorTests {
}
@Test
void testWhenTargetTypeIsExactlyTheCollectionInterfaceUsesFallbackCollectionType() {
void whenTargetTypeIsExactlyTheCollectionInterfaceUsesFallbackCollectionType() {
CustomCollectionEditor editor = new CustomCollectionEditor(Collection.class);
editor.setValue("0, 1, 2");
Collection<?> value = (Collection<?>) editor.getValue();
@@ -75,7 +75,7 @@ class CustomCollectionEditorTests {
}
@Test
void testSunnyDaySetAsTextYieldsSingleValue() {
void sunnyDaySetAsTextYieldsSingleValue() {
CustomCollectionEditor editor = new CustomCollectionEditor(ArrayList.class);
editor.setValue("0, 1, 2");
Object value = editor.getValue();
@@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class FileEditorTests {
@Test
void testClasspathFileName() {
void classpathFileName() {
PropertyEditor fileEditor = new FileEditor();
fileEditor.setAsText("classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".class");
@@ -45,14 +45,14 @@ class FileEditorTests {
}
@Test
void testWithNonExistentResource() {
void withNonExistentResource() {
PropertyEditor fileEditor = new FileEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
fileEditor.setAsText("classpath:no_way_this_file_is_found.doc"));
}
@Test
void testWithNonExistentFile() {
void withNonExistentFile() {
PropertyEditor fileEditor = new FileEditor();
fileEditor.setAsText("file:no_way_this_file_is_found.doc");
Object value = fileEditor.getValue();
@@ -62,7 +62,7 @@ class FileEditorTests {
}
@Test
void testAbsoluteFileName() {
void absoluteFileName() {
PropertyEditor fileEditor = new FileEditor();
fileEditor.setAsText("/no_way_this_file_is_found.doc");
Object value = fileEditor.getValue();
@@ -72,7 +72,7 @@ class FileEditorTests {
}
@Test
void testCurrentDirectory() {
void currentDirectory() {
PropertyEditor fileEditor = new FileEditor();
fileEditor.setAsText("file:.");
Object value = fileEditor.getValue();
@@ -82,7 +82,7 @@ class FileEditorTests {
}
@Test
void testUnqualifiedFileNameFound() {
void unqualifiedFileNameFound() {
PropertyEditor fileEditor = new FileEditor();
String fileName = ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".class";
@@ -96,7 +96,7 @@ class FileEditorTests {
}
@Test
void testUnqualifiedFileNameNotFound() {
void unqualifiedFileNameNotFound() {
PropertyEditor fileEditor = new FileEditor();
String fileName = ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".clazz";
@@ -35,13 +35,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class InputStreamEditorTests {
@Test
void testCtorWithNullResourceEditor() {
void ctorWithNullResourceEditor() {
assertThatIllegalArgumentException().isThrownBy(() ->
new InputStreamEditor(null));
}
@Test
void testSunnyDay() throws IOException {
void sunnyDay() throws IOException {
InputStream stream = null;
try {
String resource = "classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
@@ -62,14 +62,14 @@ class InputStreamEditorTests {
}
@Test
void testWhenResourceDoesNotExist() {
void whenResourceDoesNotExist() {
InputStreamEditor editor = new InputStreamEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText("classpath:bingo!"));
}
@Test
void testGetAsTextReturnsNullByDefault() {
void getAsTextReturnsNullByDefault() {
assertThat(new InputStreamEditor().getAsText()).isNull();
String resource = "classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
"/" + ClassUtils.getShortName(getClass()) + ".class";
@@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class PathEditorTests {
@Test
void testClasspathPathName() {
void classpathPathName() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".class");
@@ -46,14 +46,14 @@ class PathEditorTests {
}
@Test
void testWithNonExistentResource() {
void withNonExistentResource() {
PropertyEditor pathEditor = new PathEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
pathEditor.setAsText("classpath:/no_way_this_file_is_found.doc"));
}
@Test
void testWithNonExistentPath() {
void withNonExistentPath() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("file:/no_way_this_file_is_found.doc");
Object value = pathEditor.getValue();
@@ -63,7 +63,7 @@ class PathEditorTests {
}
@Test
void testAbsolutePath() {
void absolutePath() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("/no_way_this_file_is_found.doc");
Object value = pathEditor.getValue();
@@ -73,7 +73,7 @@ class PathEditorTests {
}
@Test
void testWindowsAbsolutePath() {
void windowsAbsolutePath() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("C:\\no_way_this_file_is_found.doc");
Object value = pathEditor.getValue();
@@ -83,7 +83,7 @@ class PathEditorTests {
}
@Test
void testWindowsAbsoluteFilePath() {
void windowsAbsoluteFilePath() {
PropertyEditor pathEditor = new PathEditor();
try {
pathEditor.setAsText("file://C:\\no_way_this_file_is_found.doc");
@@ -100,7 +100,7 @@ class PathEditorTests {
}
@Test
void testCurrentDirectory() {
void currentDirectory() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("file:.");
Object value = pathEditor.getValue();
@@ -110,7 +110,7 @@ class PathEditorTests {
}
@Test
void testUnqualifiedPathNameFound() {
void unqualifiedPathNameFound() {
PropertyEditor pathEditor = new PathEditor();
String fileName = ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".class";
@@ -128,7 +128,7 @@ class PathEditorTests {
}
@Test
void testUnqualifiedPathNameNotFound() {
void unqualifiedPathNameNotFound() {
PropertyEditor pathEditor = new PathEditor();
String fileName = ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".clazz";
@@ -35,13 +35,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class ReaderEditorTests {
@Test
void testCtorWithNullResourceEditor() {
void ctorWithNullResourceEditor() {
assertThatIllegalArgumentException().isThrownBy(() ->
new ReaderEditor(null));
}
@Test
void testSunnyDay() throws IOException {
void sunnyDay() throws IOException {
Reader reader = null;
try {
String resource = "classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
@@ -62,7 +62,7 @@ class ReaderEditorTests {
}
@Test
void testWhenResourceDoesNotExist() {
void whenResourceDoesNotExist() {
String resource = "classpath:bingo!";
ReaderEditor editor = new ReaderEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
@@ -70,7 +70,7 @@ class ReaderEditorTests {
}
@Test
void testGetAsTextReturnsNullByDefault() {
void getAsTextReturnsNullByDefault() {
assertThat(new ReaderEditor().getAsText()).isNull();
String resource = "classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
"/" + ClassUtils.getShortName(getClass()) + ".class";
@@ -37,7 +37,7 @@ class ResourceBundleEditorTests {
@Test
void testSetAsTextWithJustBaseName() {
void setAsTextWithJustBaseName() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME);
Object value = editor.getValue();
@@ -49,7 +49,7 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithBaseNameThatEndsInDefaultSeparator() {
void setAsTextWithBaseNameThatEndsInDefaultSeparator() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME + "_");
Object value = editor.getValue();
@@ -61,7 +61,7 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithBaseNameAndLanguageCode() {
void setAsTextWithBaseNameAndLanguageCode() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME + "Lang" + "_en");
Object value = editor.getValue();
@@ -73,7 +73,7 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithBaseNameLanguageAndCountryCode() {
void setAsTextWithBaseNameLanguageAndCountryCode() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME + "LangCountry" + "_en_GB");
Object value = editor.getValue();
@@ -85,7 +85,7 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithTheKitchenSink() {
void setAsTextWithTheKitchenSink() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME + "LangCountryDialect" + "_en_GB_GLASGOW");
Object value = editor.getValue();
@@ -97,28 +97,28 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithNull() {
void setAsTextWithNull() {
ResourceBundleEditor editor = new ResourceBundleEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText(null));
}
@Test
void testSetAsTextWithEmptyString() {
void setAsTextWithEmptyString() {
ResourceBundleEditor editor = new ResourceBundleEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText(""));
}
@Test
void testSetAsTextWithWhiteSpaceString() {
void setAsTextWithWhiteSpaceString() {
ResourceBundleEditor editor = new ResourceBundleEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText(" "));
}
@Test
void testSetAsTextWithJustSeparatorString() {
void setAsTextWithJustSeparatorString() {
ResourceBundleEditor editor = new ResourceBundleEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText("_"));
@@ -33,13 +33,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class URLEditorTests {
@Test
void testCtorWithNullResourceEditor() {
void ctorWithNullResourceEditor() {
assertThatIllegalArgumentException().isThrownBy(() ->
new URLEditor(null));
}
@Test
void testStandardURI() {
void standardURI() {
PropertyEditor urlEditor = new URLEditor();
urlEditor.setAsText("mailto:juergen.hoeller@interface21.com");
Object value = urlEditor.getValue();
@@ -49,7 +49,7 @@ class URLEditorTests {
}
@Test
void testStandardURL() {
void standardURL() {
PropertyEditor urlEditor = new URLEditor();
urlEditor.setAsText("https://www.springframework.org");
Object value = urlEditor.getValue();
@@ -59,7 +59,7 @@ class URLEditorTests {
}
@Test
void testClasspathURL() {
void classpathURL() {
PropertyEditor urlEditor = new URLEditor();
urlEditor.setAsText("classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
"/" + ClassUtils.getShortName(getClass()) + ".class");
@@ -71,14 +71,14 @@ class URLEditorTests {
}
@Test
void testWithNonExistentResource() {
void withNonExistentResource() {
PropertyEditor urlEditor = new URLEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
urlEditor.setAsText("gonna:/freak/in/the/morning/freak/in/the.evening"));
}
@Test
void testSetAsTextWithNull() {
void setAsTextWithNull() {
PropertyEditor urlEditor = new URLEditor();
urlEditor.setAsText(null);
assertThat(urlEditor.getValue()).isNull();
@@ -86,7 +86,7 @@ class URLEditorTests {
}
@Test
void testGetAsTextReturnsEmptyStringIfValueNotSet() {
void getAsTextReturnsEmptyStringIfValueNotSet() {
PropertyEditor urlEditor = new URLEditor();
assertThat(urlEditor.getAsText()).isEmpty();
}
@@ -38,7 +38,7 @@ class PagedListHolderTests {
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testPagedListHolder() {
void pagedListHolder() {
TestBean tb1 = new TestBean();
tb1.setName("eva");
tb1.setAge(25);
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class PropertyComparatorTests {
@Test
void testPropertyComparator() {
void propertyComparator() {
Dog dog = new Dog();
dog.setNickName("mace");
@@ -47,7 +47,7 @@ class PropertyComparatorTests {
}
@Test
void testPropertyComparatorNulls() {
void propertyComparatorNulls() {
Dog dog = new Dog();
Dog dog2 = new Dog();
PropertyComparator<Dog> c = new PropertyComparator<>("nickName", false, true);
@@ -55,7 +55,7 @@ class PropertyComparatorTests {
}
@Test
void testChainedComparators() {
void chainedComparators() {
Comparator<Dog> c = new PropertyComparator<>("lastName", false, true);
Dog dog1 = new Dog();
@@ -76,7 +76,7 @@ class PropertyComparatorTests {
}
@Test
void testChainedComparatorsReversed() {
void chainedComparatorsReversed() {
Comparator<Dog> c = (new PropertyComparator<Dog>("lastName", false, true)).
thenComparing(new PropertyComparator<>("firstName", false, true));