|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
|
* Copyright 2002-2016 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. |
|
|
|
|
@ -29,6 +29,7 @@ import java.util.Set;
@@ -29,6 +29,7 @@ import java.util.Set;
|
|
|
|
|
import java.util.TreeMap; |
|
|
|
|
import java.util.TreeSet; |
|
|
|
|
|
|
|
|
|
import org.junit.Before; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.BeanCreationException; |
|
|
|
|
@ -52,14 +53,16 @@ import static org.junit.Assert.*;
@@ -52,14 +53,16 @@ import static org.junit.Assert.*;
|
|
|
|
|
*/ |
|
|
|
|
public class XmlBeanCollectionTests { |
|
|
|
|
|
|
|
|
|
private final DefaultListableBeanFactory beanFactory; |
|
|
|
|
private final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); |
|
|
|
|
|
|
|
|
|
public XmlBeanCollectionTests() { |
|
|
|
|
this.beanFactory = new DefaultListableBeanFactory(); |
|
|
|
|
|
|
|
|
|
@Before |
|
|
|
|
public void loadBeans() { |
|
|
|
|
new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions( |
|
|
|
|
new ClassPathResource("collections.xml", getClass())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testCollectionFactoryDefaults() throws Exception { |
|
|
|
|
ListFactoryBean listFactory = new ListFactoryBean(); |
|
|
|
|
@ -327,6 +330,15 @@ public class XmlBeanCollectionTests {
@@ -327,6 +330,15 @@ public class XmlBeanCollectionTests {
|
|
|
|
|
assertTrue(hasMap.getObjectArray()[1].equals(this.beanFactory.getBean("jenny"))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testIntegerArray() throws Exception { |
|
|
|
|
HasMap hasMap = (HasMap) this.beanFactory.getBean("integerArray"); |
|
|
|
|
assertTrue(hasMap.getIntegerArray().length == 3); |
|
|
|
|
assertTrue(hasMap.getIntegerArray()[0].intValue() == 0); |
|
|
|
|
assertTrue(hasMap.getIntegerArray()[1].intValue() == 1); |
|
|
|
|
assertTrue(hasMap.getIntegerArray()[2].intValue() == 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testClassArray() throws Exception { |
|
|
|
|
HasMap hasMap = (HasMap) this.beanFactory.getBean("classArray"); |
|
|
|
|
@ -336,12 +348,11 @@ public class XmlBeanCollectionTests {
@@ -336,12 +348,11 @@ public class XmlBeanCollectionTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testIntegerArray() throws Exception { |
|
|
|
|
HasMap hasMap = (HasMap) this.beanFactory.getBean("integerArray"); |
|
|
|
|
assertTrue(hasMap.getIntegerArray().length == 3); |
|
|
|
|
assertTrue(hasMap.getIntegerArray()[0].intValue() == 0); |
|
|
|
|
assertTrue(hasMap.getIntegerArray()[1].intValue() == 1); |
|
|
|
|
assertTrue(hasMap.getIntegerArray()[2].intValue() == 2); |
|
|
|
|
public void testClassList() throws Exception { |
|
|
|
|
HasMap hasMap = (HasMap) this.beanFactory.getBean("classList"); |
|
|
|
|
assertTrue(hasMap.getClassList().size()== 2); |
|
|
|
|
assertTrue(hasMap.getClassList().get(0).equals(String.class)); |
|
|
|
|
assertTrue(hasMap.getClassList().get(1).equals(Exception.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
@ -447,4 +458,5 @@ public class XmlBeanCollectionTests {
@@ -447,4 +458,5 @@ public class XmlBeanCollectionTests {
|
|
|
|
|
return obj; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|