### Question:
LevelProgress { public static LevelProgress parse(String jsonString) { JSONObject json; try { json = new JSONObject(jsonString); } catch (Exception e) { throw jsonFormatError(e, jsonString); } return new LevelProgress(json); } LevelProgress();  LevelProgress(MultiplayerType type);  LevelProgress(JSONObject json); static LevelProgress parse(String jsonString); JSONObject saveTo(JSONObject json); void change(int level, int passed); void change(int level); static JSONObject winLevel(JSONObject json); boolean isValid(); boolean canChange(int level); @Override String toString();  }### Answer:
@Test public void constructFromJSONString_invalidJson() { String json = "bad_data"; try { LevelProgress.parse(json); fail(); } catch (Exception e) { assertEquals("Bad progress json format: " + "A JSONObject text must begin with '{' at 1 [character 2 line 1]: " + "bad_data", e.getMessage()); } }
@Test public void constructFromJSONString_invalidJsonData() { String json = "{'bad':'data'}"; try { LevelProgress.parse(json); fail(); } catch (Exception e) { assertEquals("Bad progress json format: " + "JSONObject[\"levelProgress\"] not found.: " + "{\"bad\":\"data\"}", e.getMessage()); } }
@Test public void constructFromJSONString_invalidValue() { int bug = 150; String json = "{'levelProgress':{'total':3,'current':" + bug + ",'lastPassed':0}}"; try { LevelProgress.parse(json); fail(); } catch (Exception e) { assertEquals("Progress is invalid: {'current':150,'passed':0,'total':3,'valid':false}", e.getMessage()); } }