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

The following examples show how to use org.springframework.tests.sample.beans.GenericBean#setMapOfMaps() . 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 testGenericMapOfMaps() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<>();
	Map<String, Map<Integer, Long>> map = new HashMap<>();
	map.put("mykey", new HashMap<>());
	gb.setMapOfMaps(map);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("mapOfMaps[mykey][10]", new Long(5));
	assertEquals(new Long(5), bw.getPropertyValue("mapOfMaps[mykey][10]"));
	assertEquals(new Long(5), gb.getMapOfMaps().get("mykey").get(10));
}
 
Example 2
Source File: BeanWrapperGenericsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testGenericMapOfMapsWithElementConversion() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<>();
	Map<String, Map<Integer, Long>> map = new HashMap<>();
	map.put("mykey", new HashMap<>());
	gb.setMapOfMaps(map);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("mapOfMaps[mykey][10]", "5");
	assertEquals(new Long(5), bw.getPropertyValue("mapOfMaps[mykey][10]"));
	assertEquals(new Long(5), gb.getMapOfMaps().get("mykey").get(10));
}
 
Example 3
Source File: BeanWrapperGenericsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGenericMapOfMaps() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<>();
	Map<String, Map<Integer, Long>> map = new HashMap<>();
	map.put("mykey", new HashMap<>());
	gb.setMapOfMaps(map);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("mapOfMaps[mykey][10]", new Long(5));
	assertEquals(new Long(5), bw.getPropertyValue("mapOfMaps[mykey][10]"));
	assertEquals(new Long(5), gb.getMapOfMaps().get("mykey").get(10));
}
 
Example 4
Source File: BeanWrapperGenericsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGenericMapOfMapsWithElementConversion() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<>();
	Map<String, Map<Integer, Long>> map = new HashMap<>();
	map.put("mykey", new HashMap<>());
	gb.setMapOfMaps(map);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("mapOfMaps[mykey][10]", "5");
	assertEquals(new Long(5), bw.getPropertyValue("mapOfMaps[mykey][10]"));
	assertEquals(new Long(5), gb.getMapOfMaps().get("mykey").get(10));
}
 
Example 5
Source File: BeanWrapperGenericsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericMapOfMaps() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<String>();
	Map<String, Map<Integer, Long>> map = new HashMap<String, Map<Integer, Long>>();
	map.put("mykey", new HashMap<Integer, Long>());
	gb.setMapOfMaps(map);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("mapOfMaps[mykey][10]", new Long(5));
	assertEquals(new Long(5), bw.getPropertyValue("mapOfMaps[mykey][10]"));
	assertEquals(new Long(5), gb.getMapOfMaps().get("mykey").get(10));
}
 
Example 6
Source File: BeanWrapperGenericsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericMapOfMapsWithElementConversion() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<String>();
	Map<String, Map<Integer, Long>> map = new HashMap<String, Map<Integer, Long>>();
	map.put("mykey", new HashMap<Integer, Long>());
	gb.setMapOfMaps(map);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("mapOfMaps[mykey][10]", "5");
	assertEquals(new Long(5), bw.getPropertyValue("mapOfMaps[mykey][10]"));
	assertEquals(new Long(5), gb.getMapOfMaps().get("mykey").get(10));
}