### Question:
SnapObject { public static SnapObject fromJSON(final JSONObject obj) { return new SnapObject(vec3FromJSON((JSONArray) obj.get("pos")), vec3FromJSON((JSONArray) obj.get("vel"))); } SnapObject(final IVector3 pos, final IVector3 vel); final IVector3 getPos(); final IVector3 getVel(); @Override boolean equals(final Object o); @Override int hashCode(); @SuppressWarnings("unchecked") JSONObject toJSON(); static SnapObject fromJSON(final JSONObject obj); @Override String toString();  }### Answer:
@Test public void testFromJSON() throws ParseException { JSONParser parser = new JSONParser(); SnapObject obj = new SnapObject(Vector3.zero(), Vector3.zero()); assertEquals(obj, SnapObject.fromJSON((JSONObject) parser.parse("{\"pos\":[0.0,0.0,0.0],\"vel\":[0.0,0.0,0.0]}"))); obj = new SnapObject(Vector3.fromXYZ(0, 1, 0), Vector3.zero()); assertEquals(obj, SnapObject.fromJSON((JSONObject) parser.parse("{\"pos\":[0.0,1.0,0.0],\"vel\":[0.0,0.0,0.0]}"))); obj = new SnapObject(Vector3.fromXYZ(0, 1, 0), Vector3.fromXYZ(3, 4, 0)); assertEquals(obj, SnapObject.fromJSON((JSONObject) parser.parse("{\"pos\":[0.0,1.0,0.0],\"vel\":[3.0,4.0,0.0]}"))); }