Browse Source

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

Issue: SPR-10994
pull/676/merge
Juergen Hoeller 10 years ago
parent
commit
9243869763
  1. 8
      spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java
  2. 5
      spring-beans/src/test/resources/org/springframework/beans/factory/xml/testUtilNamespace.xml

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

@ -36,6 +36,7 @@ import org.springframework.core.io.ClassPathResource; @@ -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 { @@ -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");

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

@ -49,6 +49,11 @@ @@ -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>

Loading…
Cancel
Save