### Question:
Snapshot { @SuppressWarnings("unchecked") public JSONObject toJSON() { JSONObject obj = new JSONObject(); obj.put("bots", botsToJSON(bots)); obj.put("ball", ball.toJSON()); return obj; } 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 testToJSON() { Snapshot snapshot = new Snapshot(new HashMap<>(), new SnapObject(Vector3.zero(), Vector3.zero())); assertEquals("{\"ball\":{\"pos\":[0.0,0.0,0.0],\"vel\":[0.0,0.0,0.0]},\"bots\":[]}", snapshot.toJSON().toJSONString()); 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( "{\"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\"}}]}", snapshot.toJSON().toJSONString()); }