public void testMaps()
{
TypeFactory tf = TypeFactory.defaultInstance();
// Ok, first: let's test what happens when we pass 'raw' Map:
JavaType t = tf.constructType(HashMap.class);
assertEquals(MapType.class, t.getClass());
assertSame(HashMap.class, t.getRawClass());
// Then explicit construction
t = tf.constructMapType(TreeMap.class, String.class, Integer.class);
assertEquals(MapType.class, t.getClass());
assertSame(String.class, ((MapType) t).getKeyType().getRawClass());
assertSame(Integer.class, ((MapType) t).getContentType().getRawClass());
// And then with TypeReference
t = tf.constructType(new TypeReference<HashMap<String,Integer>>() { });
assertEquals(MapType.class, t.getClass());
assertSame(HashMap.class, t.getRawClass());
MapType mt = (MapType) t;
assertEquals(tf.constructType(String.class), mt.getKeyType());
assertEquals(tf.constructType(Integer.class), mt.getContentType());
t = tf.constructType(new TypeReference<LongValuedMap<Boolean>>() { });
assertEquals(MapType.class, t.getClass());
assertSame(LongValuedMap.class, t.getRawClass());
mt = (MapType) t;
assertEquals(tf.constructType(Boolean.class), mt.getKeyType());
assertEquals(tf.constructType(Long.class), mt.getContentType());
}