Java Code Examples for org.springframework.tests.sample.beans.GenericBean#setShortMap()

The following examples show how to use org.springframework.tests.sample.beans.GenericBean#setShortMap() . 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 testGenericMapElement() {
	GenericBean<?> gb = new GenericBean<>();
	gb.setShortMap(new HashMap<>());
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("shortMap[4]", "5");
	assertEquals(new Integer(5), bw.getPropertyValue("shortMap[4]"));
	assertEquals(new Integer(5), gb.getShortMap().get(new Short("4")));
}
 
Example 2
Source File: BeanWrapperGenericsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGenericMapElement() {
	GenericBean<?> gb = new GenericBean<>();
	gb.setShortMap(new HashMap<>());
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("shortMap[4]", "5");
	assertEquals(new Integer(5), bw.getPropertyValue("shortMap[4]"));
	assertEquals(new Integer(5), gb.getShortMap().get(new Short("4")));
}
 
Example 3
Source File: BeanWrapperGenericsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericMapElement() {
	GenericBean<?> gb = new GenericBean<Object>();
	gb.setShortMap(new HashMap<Short, Integer>());
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("shortMap[4]", "5");
	assertEquals(new Integer(5), bw.getPropertyValue("shortMap[4]"));
	assertEquals(new Integer(5), gb.getShortMap().get(new Short("4")));
}