JSONUtils { public static JSONObject parse(String input) { try { return (JSONObject) JSONValue.parseWithException(input); } catch (ParseException e) { throw new SqoopException(SerializationError.SERIALIZATION_002, e); } } private  JSONUtils(); static JSONObject parse(String input); static JSONObject parse(Reader reader);  }
@Test public void testString() { JSONObject object = JSONUtils.parse("{\"id\":3}"); assertEquals((long)3, object.get("id")); }
@Test(expectedExceptions = SqoopException.class) public void testStringInvalid() { JSONUtils.parse("{"); }
@Test(expectedExceptions = NullPointerException.class) public void testStringNull() { JSONUtils.parse((String)null); }
@Test public void testReader() { JSONObject object = JSONUtils.parse(new StringReader("{\"id\":3}")); assertEquals((long)3, object.get("id")); }
@Test(expectedExceptions = SqoopException.class) public void testReaderInvalid() { JSONUtils.parse(new StringReader("{")); }
@Test(expectedExceptions = NullPointerException.class) public void testReaderNull() { JSONUtils.parse((Reader)null); }