Test for <util:map> with LinkedCaseInsensitiveMap and specified key/value types

Issue: SPR-10994
This commit is contained in:
Juergen Hoeller 2014-10-27 12:08:26 +01:00
parent 03bd08a6a5
commit 9243869763
2 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,7 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.tests.beans.CollectingReaderEventListener;
import org.springframework.tests.sample.beans.CustomEnum;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.LinkedCaseInsensitiveMap;
import static org.junit.Assert.*;
@ -162,6 +163,13 @@ public class UtilNamespaceHandlerTests {
assertEquals(this.beanFactory.getBean("testBean"), map.get("bean"));
}
@Test
public void testMapWithTypes() {
Map map = (Map) this.beanFactory.getBean("mapWithTypes");
assertTrue(map instanceof LinkedCaseInsensitiveMap);
assertEquals(this.beanFactory.getBean("testBean"), map.get("bean"));
}
@Test
public void testNestedCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("nestedCollectionsBean");

View File

@ -49,6 +49,11 @@
<entry key="bean" value-ref="testBean"/>
</util:map>
<util:map id="mapWithTypes" map-class="org.springframework.util.LinkedCaseInsensitiveMap"
key-type="java.lang.String" value-type="org.springframework.tests.sample.beans.TestBean">
<entry key="bean" value-ref="testBean"/>
</util:map>
<util:list id="simpleList">
<value>Rob Harrop</value>
</util:list>