Skip to content

Commit 9243869

Browse files
committed
Test for <util:map> with LinkedCaseInsensitiveMap and specified key/value types
Issue: SPR-10994
1 parent 03bd08a commit 9243869

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.springframework.tests.beans.CollectingReaderEventListener;
3737
import org.springframework.tests.sample.beans.CustomEnum;
3838
import org.springframework.tests.sample.beans.TestBean;
39+
import org.springframework.util.LinkedCaseInsensitiveMap;
3940

4041
import static org.junit.Assert.*;
4142

@@ -162,6 +163,13 @@ public void testMapWithRef() {
162163
assertEquals(this.beanFactory.getBean("testBean"), map.get("bean"));
163164
}
164165

166+
@Test
167+
public void testMapWithTypes() {
168+
Map map = (Map) this.beanFactory.getBean("mapWithTypes");
169+
assertTrue(map instanceof LinkedCaseInsensitiveMap);
170+
assertEquals(this.beanFactory.getBean("testBean"), map.get("bean"));
171+
}
172+
165173
@Test
166174
public void testNestedCollections() {
167175
TestBean bean = (TestBean) this.beanFactory.getBean("nestedCollectionsBean");

spring-beans/src/test/resources/org/springframework/beans/factory/xml/testUtilNamespace.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
<entry key="bean" value-ref="testBean"/>
5050
</util:map>
5151

52+
<util:map id="mapWithTypes" map-class="org.springframework.util.LinkedCaseInsensitiveMap"
53+
key-type="java.lang.String" value-type="org.springframework.tests.sample.beans.TestBean">
54+
<entry key="bean" value-ref="testBean"/>
55+
</util:map>
56+
5257
<util:list id="simpleList">
5358
<value>Rob Harrop</value>
5459
</util:list>

0 commit comments

Comments
 (0)