### Question:
GoalID extends Message { public static GoalID fromJsonObject(JsonObject jsonObject) { Time stamp = jsonObject.containsKey(GoalID.FIELD_STAMP) ? Time .fromJsonObject(jsonObject.getJsonObject(GoalID.FIELD_STAMP)) : new Time(); String id = jsonObject.containsKey(GoalID.FIELD_ID) ? jsonObject .getString(GoalID.FIELD_ID) : ""; return new GoalID(stamp, id); } GoalID();  GoalID(Time stamp, String id); Time getStamp(); String getID(); @Override GoalID clone(); static GoalID fromJsonString(String jsonString); static GoalID fromMessage(Message m); static GoalID fromJsonObject(JsonObject jsonObject); static final String FIELD_STAMP; static final String FIELD_ID; static final String TYPE; }### Answer:
@Test public void testFromJsonObject() { JsonObject jsonObject = Json.createObjectBuilder() .add(GoalID.FIELD_STAMP, g1.getStamp().toJsonObject()) .add(GoalID.FIELD_ID, g1.getID()).build(); GoalID p = GoalID.fromJsonObject(jsonObject); assertEquals(g1.toString(), p.toString()); assertEquals(g1.toJsonObject(), p.toJsonObject()); assertEquals(g1.getMessageType(), p.getMessageType()); assertEquals(g1.getStamp(), p.getStamp()); assertEquals(g1.getID(), p.getID()); assertNotSame(g1, p); assertNotSame(g1.toString(), p.toString()); assertNotSame(g1.toJsonObject(), p.toJsonObject()); }