### Question:
JsonParser { @SuppressWarnings("unchecked") public static Object parse(String raw) throws IOException { JsonReader jr = new JsonReader(new StringReader(raw)); try { return parseRecursive(jr); } finally { try { jr.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close", e); } } } private  JsonParser(); @SuppressWarnings("unchecked") static Object parse(String raw);  }### Answer:
@Test public void emptyObject() throws IOException { assertEquals(new LinkedHashMap<String, Object>(), JsonParser.parse("{}")); }
@Test public void emptyArray() throws IOException { assertEquals(new ArrayList<>(), JsonParser.parse("[]")); }
@Test public void intNumber() throws IOException { assertEquals(Double.valueOf("1"), JsonParser.parse("1")); }
@Test public void doubleNumber() throws IOException { assertEquals(Double.valueOf("1.2"), JsonParser.parse("1.2")); }
@Test public void longNumber() throws IOException { assertEquals(Double.valueOf("9999999999"), JsonParser.parse("9999999999")); }
@Test public void booleanValue() throws IOException { assertEquals(true, JsonParser.parse("true")); }
@Test public void nullValue() throws IOException { assertEquals(null, JsonParser.parse("null")); }
@Test public void nanFails() throws IOException { thrown.expect(MalformedJsonException.class); JsonParser.parse("NaN"); }
@Test public void objectEarlyEnd() throws IOException { thrown.expect(MalformedJsonException.class); JsonParser.parse("{foo:}"); }
@Test public void earlyEndArray() throws IOException { thrown.expect(EOFException.class); JsonParser.parse("[1, 2, "); }
@Test public void arrayMissingElement() throws IOException { thrown.expect(MalformedJsonException.class); JsonParser.parse("[1, 2, ]"); }
@Test public void objectMissingElement() throws IOException { thrown.expect(MalformedJsonException.class); JsonParser.parse("{1: "); }
@Test public void objectNoName() throws IOException { thrown.expect(MalformedJsonException.class); JsonParser.parse("{: 1"); }
@Test public void objectStringName() throws IOException { LinkedHashMap<String, Object> expected = new LinkedHashMap<String, Object>(); expected.put("hi", Double.valueOf("2")); assertEquals(expected, JsonParser.parse("{\"hi\": 2}")); }