Properties values get properly converted to generic Map types (fixing 4.x regression without use of ConversionService)

Issue: SPR-13256
This commit is contained in:
Juergen Hoeller
2015-08-31 17:20:05 +02:00
parent acc8c895bf
commit d4a23b81e9
2 changed files with 14 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 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.
@@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.junit.Test;
@@ -182,6 +183,18 @@ public class BeanWrapperGenericsTests {
assertTrue(gb.getCollectionMap().get(new Integer(1)) instanceof HashSet);
}
@Test
public void testGenericMapFromProperties() {
GenericBean<?> gb = new GenericBean<Object>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Properties input = new Properties();
input.setProperty("4", "5");
input.setProperty("6", "7");
bw.setPropertyValue("shortMap", input);
assertEquals(new Integer(5), gb.getShortMap().get(new Short("4")));
assertEquals(new Integer(7), gb.getShortMap().get(new Short("6")));
}
@Test
public void testGenericListOfLists() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();