}
@Test
public void testResolvingClassWithMaps() {
FlowPropertyProvider flowPropertyProvider = null;
DataClassDefinitionImpl dataClassDefinition = DataClassDefinitionImpl.map(Long.class, String.class, List.class);
getFlowTranslatorResolver().resolve("", dataClassDefinition, true);
assertEquals(dataClassDefinition.getDataClass(), Map.class);
assertNotNull(dataClassDefinition.getFlowTranslator());
assertTrue(dataClassDefinition.getFlowTranslator() instanceof MapFlowTranslator, dataClassDefinition.getFlowTranslator().toString());
// look at the map's values
DataClassDefinition elementDataClassDefinition = dataClassDefinition.getElementDataClassDefinition();
assertNotNull(elementDataClassDefinition);
assertEquals(elementDataClassDefinition.getDataClass(), List.class);
assertNotNull(elementDataClassDefinition.getFlowTranslator());
assertTrue(elementDataClassDefinition.getFlowTranslator() instanceof ListFlowTranslator,
elementDataClassDefinition.getFlowTranslator().toString());
assertNotNull(elementDataClassDefinition.getElementDataClassDefinition().getFlowTranslator());
assertTrue(elementDataClassDefinition.getElementDataClassDefinition().getFlowTranslator() instanceof CharSequenceFlowTranslator,
elementDataClassDefinition.getElementDataClassDefinition().getFlowTranslator().toString());
// look at the maps's keys
assertNotNull(dataClassDefinition.getKeyDataClassDefinition());
assertNotNull(dataClassDefinition.getKeyDataClassDefinition().getFlowTranslator());
assertTrue(dataClassDefinition.getKeyDataClassDefinition().getFlowTranslator() instanceof LongFlowTranslator);
// verify that the result can be used.
Map<Long, List<String>> map = new LinkedHashMap<Long, List<String>>();
List<String> expected34 = Arrays.asList("foo34", "bar34");
map.put(new Long(34), expected34);
List<String> expected3 = Arrays.asList("foo3", "bar3");
map.put(new Long(3), expected3);
String serializedResult = (String) dataClassDefinition.serialize(null, map);
assertEquals(serializedResult, "{\"34\":[\"foo34\",\"bar34\"],\"3\":[\"foo3\",\"bar3\"]}");
Map<Long, List<String>> reMap = dataClassDefinition.deserialize(flowPropertyProvider, null, serializedResult);
assertEquals(reMap.size(), 2);
List<String> set34 = reMap.get(new Long(34));
List<String> set3 = reMap.get(new Long(3));
assertTrue(set34.containsAll(expected34));
assertTrue(set3.containsAll(expected3));