### Question:
Snapshot { public static Snapshot fromJSON(final JSONObject obj) { Map<BotID, SnapObject> bots = botsFromJSON((JSONArray) obj.get("bots")); SnapObject ball = SnapObject.fromJSON((JSONObject) obj.get("ball")); return new Snapshot(bots, ball); } Snapshot(final Map<BotID, SnapObject> bots, final SnapObject ball); Map<BotID, SnapObject> getBots(); void setBots(final Map<BotID, SnapObject> bots); SnapObject getBall(); void setBall(final SnapObject ball); @Override boolean equals(final Object o); @Override int hashCode(); @SuppressWarnings("unchecked") JSONObject toJSON(); static Snapshot fromJSON(final JSONObject obj); static Snapshot fromJSONString(final String json); static Snapshot loadFromFile(final String path); static Snapshot loadFromFile(final Path path); static Snapshot loadFromResources(final String filename); void save(final String target); @Override String toString();  }### Answer:
@Test public void testFromJSON() throws ParseException { JSONParser parser = new JSONParser(); Snapshot snapshot = new Snapshot(new HashMap<>(), new SnapObject(Vector3.zero(), Vector3.zero())); assertEquals(snapshot, Snapshot.fromJSON( (JSONObject) parser.parse("{\"ball\":{\"pos\":[0.0,0.0,0.0],\"vel\":[0.0,0.0,0.0]},\"bots\":[]}"))); Map<BotID, SnapObject> bots = new HashMap<>(); bots.put(BotID.createBotId(0, ETeamColor.BLUE), new SnapObject(Vector3.zero(), Vector3.zero())); snapshot = new Snapshot(bots, new SnapObject(Vector3.zero(), Vector3.zero())); assertEquals(snapshot, Snapshot.fromJSON( (JSONObject) parser.parse( "{\"ball\":{\"pos\":[0.0,0.0,0.0],\"vel\":[0.0,0.0,0.0]},\"bots\":[{\"obj\":{\"pos\":[0.0,0.0,0.0],\"vel\":[0.0,0.0,0.0]},\"id\":{\"number\":0,\"color\":\"BLUE\"}}]}"))); }