List of usage examples for jdk.nashorn.internal.parser JSONParser JSONParser
JSONParser
From source file:assigment2.CourseTest.java
@Test public void testToString() { try {// w w w . j a va2 s . com Student instance = new Student("Bill Smith", "c0123456", "male", 89.3); JSONObject expResult = (JSONObject) new JSONParser().parse("{\"name\":\"Bill Smith\",\"id\":\"c0123456\"},\"gender\":\"male\",\"grade\":\"89.3}"); JSONObject result = (JSONObject) new JSONParser().parse(instance.toString()); assertEquals(expResult, result); } catch (ParseException ex) { fail("One of the JSON Objects is invalid JSON. Go to jsonlint.com to find out why."); } }