Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -440,7 +440,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
accessor.setConversionService(new DefaultConversionService());
|
||||
accessor.setAutoGrowNestedPaths(true);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("favoriteNumber", "9");
|
||||
accessor.setPropertyValue("list[0]", map);
|
||||
assertEquals(map, target.list.get(0));
|
||||
@@ -820,7 +820,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
assertTrue("correct values", target.stringArray[0].equals("foo") && target.stringArray[1].equals("fi") &&
|
||||
target.stringArray[2].equals("fi") && target.stringArray[3].equals("fum"));
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("foo");
|
||||
list.add("fi");
|
||||
list.add("fi");
|
||||
@@ -830,7 +830,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
assertTrue("correct values", target.stringArray[0].equals("foo") && target.stringArray[1].equals("fi") &&
|
||||
target.stringArray[2].equals("fi") && target.stringArray[3].equals("fum"));
|
||||
|
||||
Set<String> set = new HashSet<String>();
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("foo");
|
||||
set.add("fi");
|
||||
set.add("fum");
|
||||
@@ -863,7 +863,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
assertTrue("correct values", target.stringArray[0].equals("foo") && target.stringArray[1].equals("fi") &&
|
||||
target.stringArray[2].equals("fi") && target.stringArray[3].equals("fum"));
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("4foo");
|
||||
list.add("7fi");
|
||||
list.add("6fi");
|
||||
@@ -873,7 +873,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
assertTrue("correct values", target.stringArray[0].equals("foo") && target.stringArray[1].equals("fi") &&
|
||||
target.stringArray[2].equals("fi") && target.stringArray[3].equals("fum"));
|
||||
|
||||
Set<String> set = new HashSet<String>();
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("4foo");
|
||||
set.add("7fi");
|
||||
set.add("6fum");
|
||||
@@ -1142,7 +1142,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setGenericArrayProperty() {
|
||||
SkipReaderStub target = new SkipReaderStub();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
List<String> values = new LinkedList<String>();
|
||||
List<String> values = new LinkedList<>();
|
||||
values.add("1");
|
||||
values.add("2");
|
||||
values.add("3");
|
||||
@@ -1175,16 +1175,16 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setCollectionProperty() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
Collection<String> coll = new HashSet<String>();
|
||||
Collection<String> coll = new HashSet<>();
|
||||
coll.add("coll1");
|
||||
accessor.setPropertyValue("collection", coll);
|
||||
Set<String> set = new HashSet<String>();
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("set1");
|
||||
accessor.setPropertyValue("set", set);
|
||||
SortedSet<String> sortedSet = new TreeSet<String>();
|
||||
SortedSet<String> sortedSet = new TreeSet<>();
|
||||
sortedSet.add("sortedSet1");
|
||||
accessor.setPropertyValue("sortedSet", sortedSet);
|
||||
List<String> list = new LinkedList<String>();
|
||||
List<String> list = new LinkedList<>();
|
||||
list.add("list1");
|
||||
accessor.setPropertyValue("list", list);
|
||||
assertSame(coll, target.getCollection());
|
||||
@@ -1198,16 +1198,16 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setCollectionPropertyNonMatchingType() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
Collection<String> coll = new ArrayList<String>();
|
||||
Collection<String> coll = new ArrayList<>();
|
||||
coll.add("coll1");
|
||||
accessor.setPropertyValue("collection", coll);
|
||||
List<String> set = new LinkedList<String>();
|
||||
List<String> set = new LinkedList<>();
|
||||
set.add("set1");
|
||||
accessor.setPropertyValue("set", set);
|
||||
List<String> sortedSet = new ArrayList<String>();
|
||||
List<String> sortedSet = new ArrayList<>();
|
||||
sortedSet.add("sortedSet1");
|
||||
accessor.setPropertyValue("sortedSet", sortedSet);
|
||||
Set<String> list = new HashSet<String>();
|
||||
Set<String> list = new HashSet<>();
|
||||
list.add("list1");
|
||||
accessor.setPropertyValue("list", list);
|
||||
assertEquals(1, target.getCollection().size());
|
||||
@@ -1225,16 +1225,16 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setCollectionPropertyWithArrayValue() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
Collection<String> coll = new HashSet<String>();
|
||||
Collection<String> coll = new HashSet<>();
|
||||
coll.add("coll1");
|
||||
accessor.setPropertyValue("collection", coll.toArray());
|
||||
List<String> set = new LinkedList<String>();
|
||||
List<String> set = new LinkedList<>();
|
||||
set.add("set1");
|
||||
accessor.setPropertyValue("set", set.toArray());
|
||||
List<String> sortedSet = new ArrayList<String>();
|
||||
List<String> sortedSet = new ArrayList<>();
|
||||
sortedSet.add("sortedSet1");
|
||||
accessor.setPropertyValue("sortedSet", sortedSet.toArray());
|
||||
Set<String> list = new HashSet<String>();
|
||||
Set<String> list = new HashSet<>();
|
||||
list.add("list1");
|
||||
accessor.setPropertyValue("list", list.toArray());
|
||||
assertEquals(1, target.getCollection().size());
|
||||
@@ -1252,16 +1252,16 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setCollectionPropertyWithIntArrayValue() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
Collection<Integer> coll = new HashSet<Integer>();
|
||||
Collection<Integer> coll = new HashSet<>();
|
||||
coll.add(0);
|
||||
accessor.setPropertyValue("collection", new int[] {0});
|
||||
List<Integer> set = new LinkedList<Integer>();
|
||||
List<Integer> set = new LinkedList<>();
|
||||
set.add(1);
|
||||
accessor.setPropertyValue("set", new int[] {1});
|
||||
List<Integer> sortedSet = new ArrayList<Integer>();
|
||||
List<Integer> sortedSet = new ArrayList<>();
|
||||
sortedSet.add(2);
|
||||
accessor.setPropertyValue("sortedSet", new int[] {2});
|
||||
Set<Integer> list = new HashSet<Integer>();
|
||||
Set<Integer> list = new HashSet<>();
|
||||
list.add(3);
|
||||
accessor.setPropertyValue("list", new int[] {3});
|
||||
assertEquals(1, target.getCollection().size());
|
||||
@@ -1279,16 +1279,16 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setCollectionPropertyWithIntegerValue() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
Collection<Integer> coll = new HashSet<Integer>();
|
||||
Collection<Integer> coll = new HashSet<>();
|
||||
coll.add(0);
|
||||
accessor.setPropertyValue("collection", new Integer(0));
|
||||
List<Integer> set = new LinkedList<Integer>();
|
||||
List<Integer> set = new LinkedList<>();
|
||||
set.add(1);
|
||||
accessor.setPropertyValue("set", new Integer(1));
|
||||
List<Integer> sortedSet = new ArrayList<Integer>();
|
||||
List<Integer> sortedSet = new ArrayList<>();
|
||||
sortedSet.add(2);
|
||||
accessor.setPropertyValue("sortedSet", new Integer(2));
|
||||
Set<Integer> list = new HashSet<Integer>();
|
||||
Set<Integer> list = new HashSet<>();
|
||||
list.add(3);
|
||||
accessor.setPropertyValue("list", new Integer(3));
|
||||
assertEquals(1, target.getCollection().size());
|
||||
@@ -1306,13 +1306,13 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setCollectionPropertyWithStringValue() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
List<String> set = new LinkedList<String>();
|
||||
List<String> set = new LinkedList<>();
|
||||
set.add("set1");
|
||||
accessor.setPropertyValue("set", "set1");
|
||||
List<String> sortedSet = new ArrayList<String>();
|
||||
List<String> sortedSet = new ArrayList<>();
|
||||
sortedSet.add("sortedSet1");
|
||||
accessor.setPropertyValue("sortedSet", "sortedSet1");
|
||||
Set<String> list = new HashSet<String>();
|
||||
Set<String> list = new HashSet<>();
|
||||
list.add("list1");
|
||||
accessor.setPropertyValue("list", "list1");
|
||||
assertEquals(1, target.getSet().size());
|
||||
@@ -1348,7 +1348,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setMapProperty() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("key", "value");
|
||||
accessor.setPropertyValue("map", map);
|
||||
SortedMap<?, ?> sortedMap = new TreeMap<>();
|
||||
@@ -1362,10 +1362,10 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
public void setMapPropertyNonMatchingType() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
Map<String, String> map = new TreeMap<String, String>();
|
||||
Map<String, String> map = new TreeMap<>();
|
||||
map.put("key", "value");
|
||||
accessor.setPropertyValue("map", map);
|
||||
Map<String, String> sortedMap = new TreeMap<String, String>();
|
||||
Map<String, String> sortedMap = new TreeMap<>();
|
||||
sortedMap.put("sortedKey", "sortedValue");
|
||||
accessor.setPropertyValue("sortedMap", sortedMap);
|
||||
assertEquals(1, target.getMap().size());
|
||||
@@ -1422,7 +1422,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
}
|
||||
});
|
||||
|
||||
Map<Integer, String> inputMap = new HashMap<Integer, String>();
|
||||
Map<Integer, String> inputMap = new HashMap<>();
|
||||
inputMap.put(1, "rod");
|
||||
inputMap.put(2, "rob");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
@@ -1446,7 +1446,7 @@ public abstract class AbstractPropertyAccessorTests {
|
||||
}
|
||||
});
|
||||
|
||||
Map<Object, Object> inputMap = new HashMap<Object, Object>();
|
||||
Map<Object, Object> inputMap = new HashMap<>();
|
||||
inputMap.put(1, "rod");
|
||||
inputMap.put(2, "rob");
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ public abstract class AbstractPropertyValuesTests {
|
||||
assertTrue("Doesn't contain tory", !pvs.contains("tory"));
|
||||
|
||||
PropertyValue[] ps = pvs.getPropertyValues();
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
m.put("forname", "Tony");
|
||||
m.put("surname", "Blair");
|
||||
m.put("age", "50");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnum() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnum", "VALUE_1");
|
||||
assertEquals(CustomEnum.VALUE_1, gb.getCustomEnum());
|
||||
@@ -43,7 +43,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumWithNull() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnum", null);
|
||||
assertEquals(null, gb.getCustomEnum());
|
||||
@@ -51,7 +51,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumWithEmptyString() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnum", "");
|
||||
assertEquals(null, gb.getCustomEnum());
|
||||
@@ -59,7 +59,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumArrayWithSingleValue() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnumArray", "VALUE_1");
|
||||
assertEquals(1, gb.getCustomEnumArray().length);
|
||||
@@ -68,7 +68,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumArrayWithMultipleValues() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnumArray", new String[] {"VALUE_1", "VALUE_2"});
|
||||
assertEquals(2, gb.getCustomEnumArray().length);
|
||||
@@ -78,7 +78,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumArrayWithMultipleValuesAsCsv() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnumArray", "VALUE_1,VALUE_2");
|
||||
assertEquals(2, gb.getCustomEnumArray().length);
|
||||
@@ -88,7 +88,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumSetWithSingleValue() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnumSet", "VALUE_1");
|
||||
assertEquals(1, gb.getCustomEnumSet().size());
|
||||
@@ -97,7 +97,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumSetWithMultipleValues() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnumSet", new String[] {"VALUE_1", "VALUE_2"});
|
||||
assertEquals(2, gb.getCustomEnumSet().size());
|
||||
@@ -107,7 +107,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumSetWithMultipleValuesAsCsv() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnumSet", "VALUE_1,VALUE_2");
|
||||
assertEquals(2, gb.getCustomEnumSet().size());
|
||||
@@ -117,7 +117,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testCustomEnumSetWithGetterSetterMismatch() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("customEnumSetMismatch", new String[] {"VALUE_1", "VALUE_2"});
|
||||
assertEquals(2, gb.getCustomEnumSet().size());
|
||||
@@ -127,7 +127,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testStandardEnumSetWithMultipleValues() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setConversionService(new DefaultConversionService());
|
||||
assertNull(gb.getStandardEnumSet());
|
||||
@@ -139,7 +139,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testStandardEnumSetWithAutoGrowing() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setAutoGrowNestedPaths(true);
|
||||
assertNull(gb.getStandardEnumSet());
|
||||
@@ -149,11 +149,11 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testStandardEnumMapWithMultipleValues() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setConversionService(new DefaultConversionService());
|
||||
assertNull(gb.getStandardEnumMap());
|
||||
Map<String, Integer> map = new LinkedHashMap<String, Integer>();
|
||||
Map<String, Integer> map = new LinkedHashMap<>();
|
||||
map.put("VALUE_1", 1);
|
||||
map.put("VALUE_2", 2);
|
||||
bw.setPropertyValue("standardEnumMap", map);
|
||||
@@ -164,7 +164,7 @@ public final class BeanWrapperEnumTests {
|
||||
|
||||
@Test
|
||||
public void testStandardEnumMapWithAutoGrowing() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setAutoGrowNestedPaths(true);
|
||||
assertNull(gb.getStandardEnumMap());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,9 +51,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericSet() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
bw.setPropertyValue("integerSet", input);
|
||||
@@ -63,10 +63,10 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericLowerBoundedSet() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, true));
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
bw.setPropertyValue("numberSet", input);
|
||||
@@ -76,9 +76,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericSetWithConversionFailure() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
Set<TestBean> input = new HashSet<TestBean>();
|
||||
Set<TestBean> input = new HashSet<>();
|
||||
input.add(new TestBean());
|
||||
try {
|
||||
bw.setPropertyValue("integerSet", input);
|
||||
@@ -91,9 +91,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericList() throws MalformedURLException {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
List<String> input = new ArrayList<String>();
|
||||
List<String> input = new ArrayList<>();
|
||||
input.add("http://localhost:8080");
|
||||
input.add("http://localhost:9090");
|
||||
bw.setPropertyValue("resourceList", input);
|
||||
@@ -103,8 +103,8 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericListElement() throws MalformedURLException {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
gb.setResourceList(new ArrayList<Resource>());
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
gb.setResourceList(new ArrayList<>());
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("resourceList[0]", "http://localhost:8080");
|
||||
assertEquals(new UrlResource("http://localhost:8080"), gb.getResourceList().get(0));
|
||||
@@ -112,9 +112,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMap() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
bw.setPropertyValue("shortMap", input);
|
||||
@@ -124,8 +124,8 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapElement() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
gb.setShortMap(new HashMap<Short, Integer>());
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
gb.setShortMap(new HashMap<>());
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("shortMap[4]", "5");
|
||||
assertEquals(new Integer(5), bw.getPropertyValue("shortMap[4]"));
|
||||
@@ -134,9 +134,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapWithKeyType() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
bw.setPropertyValue("longMap", input);
|
||||
@@ -146,7 +146,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapElementWithKeyType() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
gb.setLongMap(new HashMap<Long, Integer>());
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("longMap[4]", "5");
|
||||
@@ -156,14 +156,14 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapWithCollectionValue() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
|
||||
Map<String, Collection> input = new HashMap<String, Collection>();
|
||||
HashSet<Integer> value1 = new HashSet<Integer>();
|
||||
Map<String, Collection> input = new HashMap<>();
|
||||
HashSet<Integer> value1 = new HashSet<>();
|
||||
value1.add(new Integer(1));
|
||||
input.put("1", value1);
|
||||
ArrayList<Boolean> value2 = new ArrayList<Boolean>();
|
||||
ArrayList<Boolean> value2 = new ArrayList<>();
|
||||
value2.add(Boolean.TRUE);
|
||||
input.put("2", value2);
|
||||
bw.setPropertyValue("collectionMap", input);
|
||||
@@ -173,11 +173,11 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapElementWithCollectionValue() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
gb.setCollectionMap(new HashMap<Number, Collection<? extends Object>>());
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
gb.setCollectionMap(new HashMap<>());
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
|
||||
HashSet<Integer> value1 = new HashSet<Integer>();
|
||||
HashSet<Integer> value1 = new HashSet<>();
|
||||
value1.add(new Integer(1));
|
||||
bw.setPropertyValue("collectionMap[1]", value1);
|
||||
assertTrue(gb.getCollectionMap().get(new Integer(1)) instanceof HashSet);
|
||||
@@ -185,7 +185,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapFromProperties() {
|
||||
GenericBean<?> gb = new GenericBean<Object>();
|
||||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
Properties input = new Properties();
|
||||
input.setProperty("4", "5");
|
||||
@@ -197,9 +197,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericListOfLists() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
List<List<Integer>> list = new LinkedList<List<Integer>>();
|
||||
list.add(new LinkedList<Integer>());
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
List<List<Integer>> list = new LinkedList<>();
|
||||
list.add(new LinkedList<>());
|
||||
gb.setListOfLists(list);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("listOfLists[0][0]", new Integer(5));
|
||||
@@ -209,9 +209,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericListOfListsWithElementConversion() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
List<List<Integer>> list = new LinkedList<List<Integer>>();
|
||||
list.add(new LinkedList<Integer>());
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
List<List<Integer>> list = new LinkedList<>();
|
||||
list.add(new LinkedList<>());
|
||||
gb.setListOfLists(list);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("listOfLists[0][0]", "5");
|
||||
@@ -221,8 +221,8 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericListOfArrays() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
ArrayList<String[]> list = new ArrayList<String[]>();
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
ArrayList<String[]> list = new ArrayList<>();
|
||||
list.add(new String[] {"str1", "str2"});
|
||||
gb.setListOfArrays(list);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
@@ -233,8 +233,8 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericListOfArraysWithElementConversion() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
ArrayList<String[]> list = new ArrayList<String[]>();
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
ArrayList<String[]> list = new ArrayList<>();
|
||||
list.add(new String[] {"str1", "str2"});
|
||||
gb.setListOfArrays(list);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
@@ -246,9 +246,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericListOfMaps() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
List<Map<Integer, Long>> list = new LinkedList<Map<Integer, Long>>();
|
||||
list.add(new HashMap<Integer, Long>());
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
List<Map<Integer, Long>> list = new LinkedList<>();
|
||||
list.add(new HashMap<>());
|
||||
gb.setListOfMaps(list);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("listOfMaps[0][10]", new Long(5));
|
||||
@@ -258,9 +258,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericListOfMapsWithElementConversion() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
List<Map<Integer, Long>> list = new LinkedList<Map<Integer, Long>>();
|
||||
list.add(new HashMap<Integer, Long>());
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
List<Map<Integer, Long>> list = new LinkedList<>();
|
||||
list.add(new HashMap<>());
|
||||
gb.setListOfMaps(list);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("listOfMaps[0][10]", "5");
|
||||
@@ -270,9 +270,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapOfMaps() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
Map<String, Map<Integer, Long>> map = new HashMap<String, Map<Integer, Long>>();
|
||||
map.put("mykey", new HashMap<Integer, Long>());
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
Map<String, Map<Integer, Long>> map = new HashMap<>();
|
||||
map.put("mykey", new HashMap<>());
|
||||
gb.setMapOfMaps(map);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("mapOfMaps[mykey][10]", new Long(5));
|
||||
@@ -282,9 +282,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapOfMapsWithElementConversion() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
Map<String, Map<Integer, Long>> map = new HashMap<String, Map<Integer, Long>>();
|
||||
map.put("mykey", new HashMap<Integer, Long>());
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
Map<String, Map<Integer, Long>> map = new HashMap<>();
|
||||
map.put("mykey", new HashMap<>());
|
||||
gb.setMapOfMaps(map);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("mapOfMaps[mykey][10]", "5");
|
||||
@@ -294,9 +294,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapOfLists() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
|
||||
map.put(new Integer(1), new LinkedList<Integer>());
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
Map<Integer, List<Integer>> map = new HashMap<>();
|
||||
map.put(new Integer(1), new LinkedList<>());
|
||||
gb.setMapOfLists(map);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("mapOfLists[1][0]", new Integer(5));
|
||||
@@ -306,9 +306,9 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericMapOfListsWithElementConversion() throws MalformedURLException {
|
||||
GenericBean<String> gb = new GenericBean<String>();
|
||||
Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
|
||||
map.put(new Integer(1), new LinkedList<Integer>());
|
||||
GenericBean<String> gb = new GenericBean<>();
|
||||
Map<Integer, List<Integer>> map = new HashMap<>();
|
||||
map.put(new Integer(1), new LinkedList<>());
|
||||
gb.setMapOfLists(map);
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.setPropertyValue("mapOfLists[1][0]", "5");
|
||||
@@ -318,7 +318,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericTypeNestingMapOfInteger() throws Exception {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("testKey", "100");
|
||||
|
||||
NestedGenericCollectionBean gb = new NestedGenericCollectionBean();
|
||||
@@ -331,7 +331,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericTypeNestingMapOfListOfInteger() throws Exception {
|
||||
Map<String, List<String>> map = new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
List<String> list = Arrays.asList(new String[] {"1", "2", "3"});
|
||||
map.put("testKey", list);
|
||||
|
||||
@@ -346,8 +346,8 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericTypeNestingListOfMapOfInteger() throws Exception {
|
||||
List<Map<String, String>> list = new LinkedList<Map<String, String>>();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
List<Map<String, String>> list = new LinkedList<>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("testKey", "5");
|
||||
list.add(map);
|
||||
|
||||
@@ -362,7 +362,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testGenericTypeNestingMapOfListOfListOfInteger() throws Exception {
|
||||
Map<String, List<List<String>>> map = new HashMap<String, List<List<String>>>();
|
||||
Map<String, List<List<String>>> map = new HashMap<>();
|
||||
List<String> list = Arrays.asList(new String[] {"1", "2", "3"});
|
||||
map.put("testKey", Collections.singletonList(list));
|
||||
|
||||
@@ -377,10 +377,10 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testComplexGenericMap() {
|
||||
Map<List<String>, List<String>> inputMap = new HashMap<List<String>, List<String>>();
|
||||
List<String> inputKey = new LinkedList<String>();
|
||||
Map<List<String>, List<String>> inputMap = new HashMap<>();
|
||||
List<String> inputKey = new LinkedList<>();
|
||||
inputKey.add("1");
|
||||
List<String> inputValue = new LinkedList<String>();
|
||||
List<String> inputValue = new LinkedList<>();
|
||||
inputValue.add("10");
|
||||
inputMap.put(inputKey, inputValue);
|
||||
|
||||
@@ -394,10 +394,10 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testComplexGenericMapWithCollectionConversion() {
|
||||
Map<Set<String>, Set<String>> inputMap = new HashMap<Set<String>, Set<String>>();
|
||||
Set<String> inputKey = new HashSet<String>();
|
||||
Map<Set<String>, Set<String>> inputMap = new HashMap<>();
|
||||
Set<String> inputKey = new HashSet<>();
|
||||
inputKey.add("1");
|
||||
Set<String> inputValue = new HashSet<String>();
|
||||
Set<String> inputValue = new HashSet<>();
|
||||
inputValue.add("10");
|
||||
inputMap.put(inputKey, inputValue);
|
||||
|
||||
@@ -411,7 +411,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testComplexGenericIndexedMapEntry() {
|
||||
List<String> inputValue = new LinkedList<String>();
|
||||
List<String> inputValue = new LinkedList<>();
|
||||
inputValue.add("10");
|
||||
|
||||
ComplexMapHolder holder = new ComplexMapHolder();
|
||||
@@ -424,7 +424,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testComplexGenericIndexedMapEntryWithCollectionConversion() {
|
||||
Set<String> inputValue = new HashSet<String>();
|
||||
Set<String> inputValue = new HashSet<>();
|
||||
inputValue.add("10");
|
||||
|
||||
ComplexMapHolder holder = new ComplexMapHolder();
|
||||
@@ -437,7 +437,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testComplexDerivedIndexedMapEntry() {
|
||||
List<String> inputValue = new LinkedList<String>();
|
||||
List<String> inputValue = new LinkedList<>();
|
||||
inputValue.add("10");
|
||||
|
||||
ComplexMapHolder holder = new ComplexMapHolder();
|
||||
@@ -450,7 +450,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
@Test
|
||||
public void testComplexDerivedIndexedMapEntryWithCollectionConversion() {
|
||||
Set<String> inputValue = new HashSet<String>();
|
||||
Set<String> inputValue = new HashSet<>();
|
||||
inputValue.add("10");
|
||||
|
||||
ComplexMapHolder holder = new ComplexMapHolder();
|
||||
@@ -511,9 +511,9 @@ public class BeanWrapperGenericsTests {
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("x", "y");
|
||||
Holder<Map<String, Object>> context = new Holder<Map<String,Object>>(data);
|
||||
Holder<Map<String, Object>> context = new Holder<>(data);
|
||||
|
||||
BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(context);
|
||||
assertEquals("y", bw.getPropertyValue("data['x']"));
|
||||
@@ -586,7 +586,7 @@ public class BeanWrapperGenericsTests {
|
||||
|
||||
private Map<List<Integer>, List<Long>> genericMap;
|
||||
|
||||
private Map<Integer, List<Long>> genericIndexedMap = new HashMap<Integer, List<Long>>();
|
||||
private Map<Integer, List<Long>> genericIndexedMap = new HashMap<>();
|
||||
|
||||
private DerivedMap derivedIndexedMap = new DerivedMap();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -101,7 +101,7 @@ public final class ConcurrentBeanFactoryTests {
|
||||
run.setDaemon(true);
|
||||
set.add(run);
|
||||
}
|
||||
for (Iterator<TestRun> it = new HashSet<TestRun>(set).iterator(); it.hasNext();) {
|
||||
for (Iterator<TestRun> it = new HashSet<>(set).iterator(); it.hasNext();) {
|
||||
TestRun run = it.next();
|
||||
run.start();
|
||||
}
|
||||
|
||||
@@ -2216,7 +2216,7 @@ public class DefaultListableBeanFactoryTests {
|
||||
@Test
|
||||
public void testPrototypeWithArrayConversionForConstructor() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
List<String> list = new ManagedList<String>();
|
||||
List<String> list = new ManagedList<>();
|
||||
list.add("myName");
|
||||
list.add("myBeanName");
|
||||
RootBeanDefinition bd = new RootBeanDefinition(DerivedTestBean.class);
|
||||
@@ -2235,7 +2235,7 @@ public class DefaultListableBeanFactoryTests {
|
||||
@Test
|
||||
public void testPrototypeWithArrayConversionForFactoryMethod() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
List<String> list = new ManagedList<String>();
|
||||
List<String> list = new ManagedList<>();
|
||||
list.add("myName");
|
||||
list.add("myBeanName");
|
||||
RootBeanDefinition bd = new RootBeanDefinition(DerivedTestBean.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -272,7 +272,7 @@ public class FactoryBeanTests {
|
||||
|
||||
public static class CountingPostProcessor implements BeanPostProcessor {
|
||||
|
||||
private final Map<String, AtomicInteger> count = new HashMap<String, AtomicInteger>();
|
||||
private final Map<String, AtomicInteger> count = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
|
||||
@@ -918,7 +918,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
|
||||
RootBeanDefinition tbm = new RootBeanDefinition(CollectionFactoryMethods.class);
|
||||
tbm.setUniqueFactoryMethodName("testBeanMap");
|
||||
bf.registerBeanDefinition("myTestBeanMap", tbm);
|
||||
bf.registerSingleton("otherMap", new HashMap<Object, Object>());
|
||||
bf.registerSingleton("otherMap", new HashMap<>());
|
||||
|
||||
MapConstructorInjectionBean bean = (MapConstructorInjectionBean) bf.getBean("annotatedBean");
|
||||
assertSame(bf.getBean("myTestBeanMap"), bean.getTestBeanMap());
|
||||
@@ -940,7 +940,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
|
||||
tbs.add(new TestBean("tb1"));
|
||||
tbs.add(new TestBean("tb2"));
|
||||
bf.registerSingleton("testBeans", tbs);
|
||||
bf.registerSingleton("otherSet", new HashSet<Object>());
|
||||
bf.registerSingleton("otherSet", new HashSet<>());
|
||||
|
||||
SetConstructorInjectionBean bean = (SetConstructorInjectionBean) bf.getBean("annotatedBean");
|
||||
assertSame(tbs, bean.getTestBeanSet());
|
||||
@@ -961,7 +961,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
|
||||
RootBeanDefinition tbs = new RootBeanDefinition(CollectionFactoryMethods.class);
|
||||
tbs.setUniqueFactoryMethodName("testBeanSet");
|
||||
bf.registerBeanDefinition("myTestBeanSet", tbs);
|
||||
bf.registerSingleton("otherSet", new HashSet<Object>());
|
||||
bf.registerSingleton("otherSet", new HashSet<>());
|
||||
|
||||
SetConstructorInjectionBean bean = (SetConstructorInjectionBean) bf.getBean("annotatedBean");
|
||||
assertSame(bf.getBean("myTestBeanSet"), bean.getTestBeanSet());
|
||||
@@ -3101,7 +3101,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
|
||||
}
|
||||
|
||||
public static GenericInterface1<String> createErased() {
|
||||
return new GenericInterface1Impl<String>();
|
||||
return new GenericInterface1Impl<>();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -3257,14 +3257,14 @@ public class AutowiredAnnotationBeanPostProcessorTests {
|
||||
public static class CollectionFactoryMethods {
|
||||
|
||||
public static Map<String, TestBean> testBeanMap() {
|
||||
Map<String, TestBean> tbm = new LinkedHashMap<String, TestBean>();
|
||||
Map<String, TestBean> tbm = new LinkedHashMap<>();
|
||||
tbm.put("testBean1", new TestBean("tb1"));
|
||||
tbm.put("testBean2", new TestBean("tb2"));
|
||||
return tbm;
|
||||
}
|
||||
|
||||
public static Set<TestBean> testBeanSet() {
|
||||
Set<TestBean> tbs = new LinkedHashSet<TestBean>();
|
||||
Set<TestBean> tbs = new LinkedHashSet<>();
|
||||
tbs.add(new TestBean("tb1"));
|
||||
tbs.add(new TestBean("tb2"));
|
||||
return tbs;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -79,7 +79,7 @@ public final class CustomEditorConfigurerTests {
|
||||
public void testCustomEditorConfigurerWithEditorAsClass() throws ParseException {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
CustomEditorConfigurer cec = new CustomEditorConfigurer();
|
||||
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<Class<?>, Class<? extends PropertyEditor>>();
|
||||
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<>();
|
||||
editors.put(Date.class, MyDateEditor.class);
|
||||
cec.setCustomEditors(editors);
|
||||
cec.postProcessBeanFactory(bf);
|
||||
@@ -99,7 +99,7 @@ public final class CustomEditorConfigurerTests {
|
||||
public void testCustomEditorConfigurerWithRequiredTypeArray() throws ParseException {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
CustomEditorConfigurer cec = new CustomEditorConfigurer();
|
||||
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<Class<?>, Class<? extends PropertyEditor>>();
|
||||
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<>();
|
||||
editors.put(String[].class, MyTestEditor.class);
|
||||
cec.setCustomEditors(editors);
|
||||
cec.postProcessBeanFactory(bf);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ public final class CustomScopeConfigurerTests {
|
||||
public void testSunnyDayWithBonaFideScopeInstance() throws Exception {
|
||||
Scope scope = mock(Scope.class);
|
||||
factory.registerScope(FOO_SCOPE, scope);
|
||||
Map<String, Object> scopes = new HashMap<String, Object>();
|
||||
Map<String, Object> scopes = new HashMap<>();
|
||||
scopes.put(FOO_SCOPE, scope);
|
||||
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
|
||||
figurer.setScopes(scopes);
|
||||
@@ -63,7 +63,7 @@ public final class CustomScopeConfigurerTests {
|
||||
|
||||
@Test
|
||||
public void testSunnyDayWithBonaFideScopeClass() throws Exception {
|
||||
Map<String, Object> scopes = new HashMap<String, Object>();
|
||||
Map<String, Object> scopes = new HashMap<>();
|
||||
scopes.put(FOO_SCOPE, NoOpScope.class);
|
||||
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
|
||||
figurer.setScopes(scopes);
|
||||
@@ -73,7 +73,7 @@ public final class CustomScopeConfigurerTests {
|
||||
|
||||
@Test
|
||||
public void testSunnyDayWithBonaFideScopeClassname() throws Exception {
|
||||
Map<String, Object> scopes = new HashMap<String, Object>();
|
||||
Map<String, Object> scopes = new HashMap<>();
|
||||
scopes.put(FOO_SCOPE, NoOpScope.class.getName());
|
||||
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
|
||||
figurer.setScopes(scopes);
|
||||
@@ -83,7 +83,7 @@ public final class CustomScopeConfigurerTests {
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testWhereScopeMapHasNullScopeValueInEntrySet() throws Exception {
|
||||
Map<String, Object> scopes = new HashMap<String, Object>();
|
||||
Map<String, Object> scopes = new HashMap<>();
|
||||
scopes.put(FOO_SCOPE, null);
|
||||
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
|
||||
figurer.setScopes(scopes);
|
||||
@@ -92,7 +92,7 @@ public final class CustomScopeConfigurerTests {
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testWhereScopeMapHasNonScopeInstanceInEntrySet() throws Exception {
|
||||
Map<String, Object> scopes = new HashMap<String, Object>();
|
||||
Map<String, Object> scopes = new HashMap<>();
|
||||
scopes.put(FOO_SCOPE, this); // <-- not a valid value...
|
||||
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
|
||||
figurer.setScopes(scopes);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -148,7 +148,7 @@ public class MethodInvokingFactoryBeanTests {
|
||||
mcfb = new MethodInvokingFactoryBean();
|
||||
mcfb.setTargetClass(TestClass1.class);
|
||||
mcfb.setTargetMethod("supertypes");
|
||||
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), "hello"});
|
||||
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), "hello"});
|
||||
mcfb.afterPropertiesSet();
|
||||
mcfb.getObjectType();
|
||||
|
||||
@@ -225,7 +225,7 @@ public class MethodInvokingFactoryBeanTests {
|
||||
mcfb = new MethodInvokingFactoryBean();
|
||||
mcfb.setTargetClass(TestClass1.class);
|
||||
mcfb.setTargetMethod("supertypes");
|
||||
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), "hello"});
|
||||
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), "hello"});
|
||||
// should pass
|
||||
mcfb.afterPropertiesSet();
|
||||
}
|
||||
@@ -235,7 +235,7 @@ public class MethodInvokingFactoryBeanTests {
|
||||
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
|
||||
mcfb.setTargetClass(TestClass1.class);
|
||||
mcfb.setTargetMethod("supertypes");
|
||||
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), "hello", "bogus"});
|
||||
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), "hello", "bogus"});
|
||||
try {
|
||||
mcfb.afterPropertiesSet();
|
||||
fail("Matched method with wrong number of args");
|
||||
@@ -260,14 +260,14 @@ public class MethodInvokingFactoryBeanTests {
|
||||
mcfb = new MethodInvokingFactoryBean();
|
||||
mcfb.setTargetClass(TestClass1.class);
|
||||
mcfb.setTargetMethod("supertypes2");
|
||||
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), "hello", "bogus"});
|
||||
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), "hello", "bogus"});
|
||||
mcfb.afterPropertiesSet();
|
||||
assertEquals("hello", mcfb.getObject());
|
||||
|
||||
mcfb = new MethodInvokingFactoryBean();
|
||||
mcfb.setTargetClass(TestClass1.class);
|
||||
mcfb.setTargetMethod("supertypes2");
|
||||
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), new Object()});
|
||||
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), new Object()});
|
||||
try {
|
||||
mcfb.afterPropertiesSet();
|
||||
fail("Matched method when shouldn't have matched");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -354,18 +354,18 @@ public class PropertyResourceConfigurerTests {
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.add("stringArray", new String[] {"${os.name}", "${age}"});
|
||||
|
||||
List<Object> friends = new ManagedList<Object>();
|
||||
List<Object> friends = new ManagedList<>();
|
||||
friends.add("na${age}me");
|
||||
friends.add(new RuntimeBeanReference("${ref}"));
|
||||
pvs.add("friends", friends);
|
||||
|
||||
Set<Object> someSet = new ManagedSet<Object>();
|
||||
Set<Object> someSet = new ManagedSet<>();
|
||||
someSet.add("na${age}me");
|
||||
someSet.add(new RuntimeBeanReference("${ref}"));
|
||||
someSet.add(new TypedStringValue("${age}", Integer.class));
|
||||
pvs.add("someSet", someSet);
|
||||
|
||||
Map<Object, Object> someMap = new ManagedMap<Object, Object>();
|
||||
Map<Object, Object> someMap = new ManagedMap<>();
|
||||
someMap.put(new TypedStringValue("key${age}"), new TypedStringValue("${age}"));
|
||||
someMap.put(new TypedStringValue("key${age}ref"), new RuntimeBeanReference("${ref}"));
|
||||
someMap.put("key1", new RuntimeBeanReference("${ref}"));
|
||||
@@ -805,9 +805,9 @@ public class PropertyResourceConfigurerTests {
|
||||
*/
|
||||
public static class MockPreferences extends AbstractPreferences {
|
||||
|
||||
private static Map<String, String> values = new HashMap<String, String>();
|
||||
private static Map<String, String> values = new HashMap<>();
|
||||
|
||||
private static Map<String, AbstractPreferences> children = new HashMap<String, AbstractPreferences>();
|
||||
private static Map<String, AbstractPreferences> children = new HashMap<>();
|
||||
|
||||
public MockPreferences() {
|
||||
super(null, "");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public final class SimpleScopeTests {
|
||||
beanFactory = new DefaultListableBeanFactory();
|
||||
Scope scope = new NoOpScope() {
|
||||
private int index;
|
||||
private List<TestBean> objects = new LinkedList<TestBean>(); {
|
||||
private List<TestBean> objects = new LinkedList<>(); {
|
||||
objects.add(new TestBean());
|
||||
objects.add(new TestBean());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,9 +66,9 @@ public final class CustomProblemReporterTests {
|
||||
|
||||
private static class CollatingProblemReporter implements ProblemReporter {
|
||||
|
||||
private List<Problem> errors = new ArrayList<Problem>();
|
||||
private List<Problem> errors = new ArrayList<>();
|
||||
|
||||
private List<Problem> warnings = new ArrayList<Problem>();
|
||||
private List<Problem> warnings = new ArrayList<>();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -83,7 +83,7 @@ public class AutowireUtilsTests {
|
||||
|
||||
// Ideally we would expect Boolean.class instead of Object.class, but this
|
||||
// information is not available at run-time due to type erasure.
|
||||
Map<Integer, Boolean> map = new HashMap<Integer, Boolean>();
|
||||
Map<Integer, Boolean> map = new HashMap<>();
|
||||
map.put(0, false);
|
||||
map.put(1, true);
|
||||
Method extractMagicValue = ReflectionUtils.findMethod(MyTypeWithMethods.class, "extractMagicValue", new Class[] { Map.class });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -65,7 +65,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
rbd.getPropertyValues().add("integerSet", input);
|
||||
@@ -82,7 +82,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
List<String> input = new ArrayList<String>();
|
||||
List<String> input = new ArrayList<>();
|
||||
input.add("http://localhost:8080");
|
||||
input.add("http://localhost:9090");
|
||||
rbd.getPropertyValues().add("resourceList", input);
|
||||
@@ -114,7 +114,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericIntegerBean.class);
|
||||
|
||||
List<Integer> input = new ArrayList<Integer>();
|
||||
List<Integer> input = new ArrayList<>();
|
||||
input.add(1);
|
||||
rbd.getPropertyValues().add("testBeanList", input);
|
||||
|
||||
@@ -146,7 +146,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
rbd.getPropertyValues().add("shortMap", input);
|
||||
@@ -178,7 +178,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -222,10 +222,10 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
List<String> input2 = new ArrayList<String>();
|
||||
List<String> input2 = new ArrayList<>();
|
||||
input2.add("http://localhost:8080");
|
||||
input2.add("http://localhost:9090");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -279,10 +279,10 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
Map<String, String> input2 = new HashMap<String, String>();
|
||||
Map<String, String> input2 = new HashMap<>();
|
||||
input2.put("4", "5");
|
||||
input2.put("6", "7");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -302,7 +302,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -321,10 +321,10 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("1", "0");
|
||||
input.put("2", "3");
|
||||
Map<String, String> input2 = new HashMap<String, String>();
|
||||
Map<String, String> input2 = new HashMap<>();
|
||||
input2.put("4", "5");
|
||||
input2.put("6", "7");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -347,7 +347,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("1", "0");
|
||||
input.put("2", "3");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -370,7 +370,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Map<Short, Integer> input = new HashMap<Short, Integer>();
|
||||
Map<Short, Integer> input = new HashMap<>();
|
||||
input.put(new Short((short) 1), new Integer(0));
|
||||
input.put(new Short((short) 2), new Integer(3));
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -390,7 +390,7 @@ public class BeanFactoryGenericsTests {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -413,11 +413,11 @@ public class BeanFactoryGenericsTests {
|
||||
});
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
|
||||
Map<String, AbstractCollection<?>> input = new HashMap<String, AbstractCollection<?>>();
|
||||
HashSet<Integer> value1 = new HashSet<Integer>();
|
||||
Map<String, AbstractCollection<?>> input = new HashMap<>();
|
||||
HashSet<Integer> value1 = new HashSet<>();
|
||||
value1.add(new Integer(1));
|
||||
input.put("1", value1);
|
||||
ArrayList<Boolean> value2 = new ArrayList<Boolean>();
|
||||
ArrayList<Boolean> value2 = new ArrayList<>();
|
||||
value2.add(Boolean.TRUE);
|
||||
input.put("2", value2);
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(Boolean.TRUE);
|
||||
@@ -437,7 +437,7 @@ public class BeanFactoryGenericsTests {
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
rbd.setFactoryMethodName("createInstance");
|
||||
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -455,10 +455,10 @@ public class BeanFactoryGenericsTests {
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
rbd.setFactoryMethodName("createInstance");
|
||||
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
List<String> input2 = new ArrayList<String>();
|
||||
List<String> input2 = new ArrayList<>();
|
||||
input2.add("http://localhost:8080");
|
||||
input2.add("http://localhost:9090");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -479,10 +479,10 @@ public class BeanFactoryGenericsTests {
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
rbd.setFactoryMethodName("createInstance");
|
||||
|
||||
Set<String> input = new HashSet<String>();
|
||||
Set<String> input = new HashSet<>();
|
||||
input.add("4");
|
||||
input.add("5");
|
||||
Map<String, String> input2 = new HashMap<String, String>();
|
||||
Map<String, String> input2 = new HashMap<>();
|
||||
input2.put("4", "5");
|
||||
input2.put("6", "7");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -503,7 +503,7 @@ public class BeanFactoryGenericsTests {
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
rbd.setFactoryMethodName("createInstance");
|
||||
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -523,10 +523,10 @@ public class BeanFactoryGenericsTests {
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
rbd.setFactoryMethodName("createInstance");
|
||||
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("1", "0");
|
||||
input.put("2", "3");
|
||||
Map<String, String> input2 = new HashMap<String, String>();
|
||||
Map<String, String> input2 = new HashMap<>();
|
||||
input2.put("4", "5");
|
||||
input2.put("6", "7");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -547,7 +547,7 @@ public class BeanFactoryGenericsTests {
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
rbd.setFactoryMethodName("createInstance");
|
||||
|
||||
Map<String, String> input = new HashMap<String, String>();
|
||||
Map<String, String> input = new HashMap<>();
|
||||
input.put("4", "5");
|
||||
input.put("6", "7");
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
|
||||
@@ -571,11 +571,11 @@ public class BeanFactoryGenericsTests {
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
|
||||
rbd.setFactoryMethodName("createInstance");
|
||||
|
||||
Map<String, AbstractCollection<?>> input = new HashMap<String, AbstractCollection<?>>();
|
||||
HashSet<Integer> value1 = new HashSet<Integer>();
|
||||
Map<String, AbstractCollection<?>> input = new HashMap<>();
|
||||
HashSet<Integer> value1 = new HashSet<>();
|
||||
value1.add(new Integer(1));
|
||||
input.put("1", value1);
|
||||
ArrayList<Boolean> value2 = new ArrayList<Boolean>();
|
||||
ArrayList<Boolean> value2 = new ArrayList<>();
|
||||
value2.add(Boolean.TRUE);
|
||||
input.put("2", value2);
|
||||
rbd.getConstructorArgumentValues().addGenericArgumentValue(Boolean.TRUE);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1362,7 +1362,7 @@ public class CustomEditorTests {
|
||||
bw.registerCustomEditor(List.class, "list", new PropertyEditorSupport() {
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
List<TestBean> result = new ArrayList<TestBean>();
|
||||
List<TestBean> result = new ArrayList<>();
|
||||
result.add(new TestBean("list" + text, 99));
|
||||
setValue(result);
|
||||
}
|
||||
@@ -1397,7 +1397,7 @@ public class CustomEditorTests {
|
||||
PropertyEditor pe = new CustomNumberEditor(Integer.class, true);
|
||||
bw.registerCustomEditor(null, "list.age", pe);
|
||||
TestBean tb = new TestBean();
|
||||
bw.setPropertyValue("list", new ArrayList<Object>());
|
||||
bw.setPropertyValue("list", new ArrayList<>());
|
||||
bw.setPropertyValue("list[0]", tb);
|
||||
assertEquals(tb, bean.getList().get(0));
|
||||
assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public class PropertyComparatorTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testCompoundComparator() {
|
||||
CompoundComparator<Dog> c = new CompoundComparator<Dog>();
|
||||
CompoundComparator<Dog> c = new CompoundComparator<>();
|
||||
c.addComparator(new PropertyComparator("lastName", false, true));
|
||||
|
||||
Dog dog1 = new Dog();
|
||||
@@ -80,7 +80,7 @@ public class PropertyComparatorTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testCompoundComparatorInvert() {
|
||||
CompoundComparator<Dog> c = new CompoundComparator<Dog>();
|
||||
CompoundComparator<Dog> c = new CompoundComparator<>();
|
||||
c.addComparator(new PropertyComparator("lastName", false, true));
|
||||
c.addComparator(new PropertyComparator("firstName", false, true));
|
||||
Dog dog1 = new Dog();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -267,7 +267,7 @@ public class GenericBean<T> {
|
||||
}
|
||||
|
||||
public void setCustomEnumSetMismatch(Set<String> customEnumSet) {
|
||||
this.customEnumSet = new HashSet<CustomEnum>(customEnumSet.size());
|
||||
this.customEnumSet = new HashSet<>(customEnumSet.size());
|
||||
for (Iterator<String> iterator = customEnumSet.iterator(); iterator.hasNext(); ) {
|
||||
this.customEnumSet.add(CustomEnum.valueOf(iterator.next()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,13 +69,13 @@ public class IndexedTestBean {
|
||||
TestBean tbX = new TestBean("nameX", 0);
|
||||
TestBean tbY = new TestBean("nameY", 0);
|
||||
this.array = new TestBean[] {tb0, tb1};
|
||||
this.list = new ArrayList<Object>();
|
||||
this.list = new ArrayList<>();
|
||||
this.list.add(tb2);
|
||||
this.list.add(tb3);
|
||||
this.set = new TreeSet<Object>();
|
||||
this.set = new TreeSet<>();
|
||||
this.set.add(tb6);
|
||||
this.set.add(tb7);
|
||||
this.map = new HashMap<Object, Object>();
|
||||
this.map = new HashMap<>();
|
||||
this.map.put("key1", tb4);
|
||||
this.map.put("key2", tb5);
|
||||
this.map.put("key.3", tb5);
|
||||
|
||||
Reference in New Issue
Block a user