Java源码示例:org.springframework.tests.sample.beans.GenericSetOfIntegerBean

示例1
@Test
public void testGenericallyTypedSetOfIntegerBean() throws Exception {
	GenericSetOfIntegerBean gb = new GenericSetOfIntegerBean();
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("genericProperty", "10");
	bw.setPropertyValue("genericListProperty", new String[] {"20", "30"});
	assertEquals(new Integer(10), gb.getGenericProperty().iterator().next());
	assertEquals(new Integer(20), gb.getGenericListProperty().get(0).iterator().next());
	assertEquals(new Integer(30), gb.getGenericListProperty().get(1).iterator().next());
}
 
示例2
@Test
public void testGenericallyTypedSetOfIntegerBean() {
	DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
	new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
			new ClassPathResource("genericBeanTests.xml", getClass()));
	GenericSetOfIntegerBean gb = (GenericSetOfIntegerBean) bf.getBean("setOfIntegerBean");
	assertEquals(new Integer(10), gb.getGenericProperty().iterator().next());
	assertEquals(new Integer(20), gb.getGenericListProperty().get(0).iterator().next());
	assertEquals(new Integer(30), gb.getGenericListProperty().get(1).iterator().next());
}
 
示例3
@Test
public void testGenericallyTypedSetOfIntegerBean() throws Exception {
	GenericSetOfIntegerBean gb = new GenericSetOfIntegerBean();
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("genericProperty", "10");
	bw.setPropertyValue("genericListProperty", new String[] {"20", "30"});
	assertEquals(new Integer(10), gb.getGenericProperty().iterator().next());
	assertEquals(new Integer(20), gb.getGenericListProperty().get(0).iterator().next());
	assertEquals(new Integer(30), gb.getGenericListProperty().get(1).iterator().next());
}
 
示例4
@Test
public void testGenericallyTypedSetOfIntegerBean() {
	DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
	new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
			new ClassPathResource("genericBeanTests.xml", getClass()));
	GenericSetOfIntegerBean gb = (GenericSetOfIntegerBean) bf.getBean("setOfIntegerBean");
	assertEquals(new Integer(10), gb.getGenericProperty().iterator().next());
	assertEquals(new Integer(20), gb.getGenericListProperty().get(0).iterator().next());
	assertEquals(new Integer(30), gb.getGenericListProperty().get(1).iterator().next());
}
 
示例5
@Test
public void testGenericallyTypedSetOfIntegerBean() throws Exception {
	GenericSetOfIntegerBean gb = new GenericSetOfIntegerBean();
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("genericProperty", "10");
	bw.setPropertyValue("genericListProperty", new String[] {"20", "30"});
	assertEquals(new Integer(10), gb.getGenericProperty().iterator().next());
	assertEquals(new Integer(20), gb.getGenericListProperty().get(0).iterator().next());
	assertEquals(new Integer(30), gb.getGenericListProperty().get(1).iterator().next());
}
 
示例6
@Test
public void testGenericallyTypedSetOfIntegerBean() throws Exception {
	DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
	new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
			new ClassPathResource("genericBeanTests.xml", getClass()));
	GenericSetOfIntegerBean gb = (GenericSetOfIntegerBean) bf.getBean("setOfIntegerBean");
	assertEquals(new Integer(10), gb.getGenericProperty().iterator().next());
	assertEquals(new Integer(20), gb.getGenericListProperty().get(0).iterator().next());
	assertEquals(new Integer(30), gb.getGenericListProperty().get(1).iterator().next());
}