@Test(groups = SMALL, expectedExceptions = IllegalArgumentException.class) public void testJsonObjectToMapThrowsExceptionForNullString() { jsonObjectToMap(null); }
public static Map<String, Object> jsonObjectToMap(JSONObject jsonObject) { notNull(jsonObject, "jsonString can not be null"); try { return new ObjectMapper().readValue(jsonObject.toString(), HashMap.class); } catch (IOException e) { throw new JSONException("Could not map row entity:" + jsonObject.toString()); } }
JsonParserUtils { public static Map<String, Object> jsonObjectToMap(JSONObject jsonObject) { notNull(jsonObject, "jsonString can not be null"); try { return new ObjectMapper().readValue(jsonObject.toString(), HashMap.class); } catch (IOException e) { throw new JSONException("Could not map row entity:" + jsonObject.toString()); } } }
JsonParserUtils { public static Map<String, Object> jsonObjectToMap(JSONObject jsonObject) { notNull(jsonObject, "jsonString can not be null"); try { return new ObjectMapper().readValue(jsonObject.toString(), HashMap.class); } catch (IOException e) { throw new JSONException("Could not map row entity:" + jsonObject.toString()); } }  }
JsonParserUtils { public static Map<String, Object> jsonObjectToMap(JSONObject jsonObject) { notNull(jsonObject, "jsonString can not be null"); try { return new ObjectMapper().readValue(jsonObject.toString(), HashMap.class); } catch (IOException e) { throw new JSONException("Could not map row entity:" + jsonObject.toString()); } }  static Map<String, Object> jsonStringToMap(String jsonString); static Map<String, Object> jsonObjectToMap(JSONObject jsonObject); }
JsonParserUtils { public static Map<String, Object> jsonObjectToMap(JSONObject jsonObject) { notNull(jsonObject, "jsonString can not be null"); try { return new ObjectMapper().readValue(jsonObject.toString(), HashMap.class); } catch (IOException e) { throw new JSONException("Could not map row entity:" + jsonObject.toString()); } }  static Map<String, Object> jsonStringToMap(String jsonString); static Map<String, Object> jsonObjectToMap(JSONObject jsonObject);  }