org.springframework.tests.sample.beans.GenericSetOfIntegerBean Java Examples

The following examples show how to use org.springframework.tests.sample.beans.GenericSetOfIntegerBean. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BeanWrapperGenericsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
}
 
Example #2
Source File: BeanFactoryGenericsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
}
 
Example #3
Source File: BeanWrapperGenericsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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());
}
 
Example #4
Source File: BeanFactoryGenericsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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());
}
 
Example #5
Source File: BeanWrapperGenericsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #6
Source File: BeanFactoryGenericsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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());
}