Search in sources :

Example 1 with MapFactoryBean

use of org.springframework.beans.factory.config.MapFactoryBean in project spring-framework by spring-projects.

the class XmlBeanCollectionTests method testCollectionFactoryDefaults.

@Test
public void testCollectionFactoryDefaults() throws Exception {
    ListFactoryBean listFactory = new ListFactoryBean();
    listFactory.setSourceList(new LinkedList());
    listFactory.afterPropertiesSet();
    assertTrue(listFactory.getObject() instanceof ArrayList);
    SetFactoryBean setFactory = new SetFactoryBean();
    setFactory.setSourceSet(new TreeSet());
    setFactory.afterPropertiesSet();
    assertTrue(setFactory.getObject() instanceof LinkedHashSet);
    MapFactoryBean mapFactory = new MapFactoryBean();
    mapFactory.setSourceMap(new TreeMap());
    mapFactory.afterPropertiesSet();
    assertTrue(mapFactory.getObject() instanceof LinkedHashMap);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) SetFactoryBean(org.springframework.beans.factory.config.SetFactoryBean) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) ListFactoryBean(org.springframework.beans.factory.config.ListFactoryBean) MapFactoryBean(org.springframework.beans.factory.config.MapFactoryBean) TreeMap(java.util.TreeMap) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 Test (org.junit.Test)1 ListFactoryBean (org.springframework.beans.factory.config.ListFactoryBean)1 MapFactoryBean (org.springframework.beans.factory.config.MapFactoryBean)1 SetFactoryBean (org.springframework.beans.factory.config.SetFactoryBean)1