### Question:
SnapObject { @SuppressWarnings("unchecked") public JSONObject toJSON() { JSONObject obj = new JSONObject(); obj.put("pos", vec3ToJSON(pos)); obj.put("vel", vec3ToJSON(vel)); return obj; } 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 testToJSON() { SnapObject obj = new SnapObject(Vector3.zero(), Vector3.zero()); assertEquals("{\"pos\":[0.0,0.0,0.0],\"vel\":[0.0,0.0,0.0]}", obj.toJSON().toJSONString()); obj = new SnapObject(Vector3.fromXYZ(0, 1, 0), Vector3.zero()); assertEquals("{\"pos\":[0.0,1.0,0.0],\"vel\":[0.0,0.0,0.0]}", obj.toJSON().toJSONString()); obj = new SnapObject(Vector3.fromXYZ(0, 1, 0), Vector3.fromXYZ(3, 4, 0)); assertEquals("{\"pos\":[0.0,1.0,0.0],\"vel\":[3.0,4.0,0.0]}", obj.toJSON().toJSONString()); }