### Question:
JsonUtils { @SuppressWarnings("unchecked") public static Map<String, String> jsonToMap(Reader in) { AwsJsonReader reader = getJsonReader(in); try { if (reader.peek() == null) { return Collections.EMPTY_MAP; } Map<String, String> map = new HashMap<String, String>(); reader.beginObject(); while (reader.hasNext()) { String key = reader.nextName(); if (reader.isContainer()) { reader.skipValue(); } else { map.put(key, reader.nextString()); } } reader.endObject(); reader.close(); return Collections.unmodifiableMap(map); } catch (IOException e) { throw new AmazonClientException("Unable to parse JSON String.", e); } }  @Deprecated static void setJsonEngine(JsonEngine jsonEngine); static AwsJsonReader getJsonReader(Reader in); static AwsJsonWriter getJsonWriter(Writer out); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(Reader in); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(String json); @SuppressWarnings("unchecked") static Map<String, String> jsonToStringMapWithList(Reader in); static String mapToString(Map<String, String> map);  }### Answer:
@Test public void testJsonToMap() { Map<String, String> map = JsonUtils.jsonToMap(JSON_STRING); assertEquals("string value", "string", map.get("string")); assertEquals("long value", "123", map.get("long")); assertEquals("double value", "123.45", map.get("double")); assertEquals("null value", null, map.get("null")); assertEquals("true value", "true", map.get("true")); assertEquals("false value", "false", map.get("false")); assertEquals("encoding", "Chloë", map.get("encoding")); assertNull("array is ignored", map.get("array")); assertNull("object is ignored", map.get("object")); }
@Test public void testNullJsonToMap() { String nullStr = null; Map<String, String> map = JsonUtils.jsonToMap(nullStr); assertNotNull("map isn't null", map); assertTrue("map is empty", map.isEmpty()); }
@Test public void testEmptyJsonToMap() { String json = ""; Map<String, String> map = JsonUtils.jsonToMap(json); assertTrue("empty string", map.isEmpty()); }