Esempio n. 1
0
 @Test
 public void mapWithInfiniteFloatValueKey() {
   Map<String, Float> map = new HashMap<String, Float>();
   map.put("test", Float.POSITIVE_INFINITY);
   try {
     String json = createJsonMapper().toJson(map);
     fail("Map with infinity value should not be possible");
   } catch (FacebookJsonMappingException fe) {
     assertTrue(fe.getMessage().startsWith("Unable to process value"));
   }
 }
Esempio n. 2
0
 @Test
 public void mapWithNoStringKey() {
   Map<Integer, Integer> map = new HashMap<Integer, Integer>();
   map.put(1, 3);
   map.put(2, 1);
   try {
     String json = createJsonMapper().toJson(map);
     fail("Map with non String keys should not be possible");
   } catch (FacebookJsonMappingException fe) {
     assertTrue(
         fe.getMessage().startsWith("Your Map keys must be of type class java.lang.String"));
   }
 }