### Question:
QuaternionStamped extends Message { public static QuaternionStamped fromJsonObject(JsonObject jsonObject) { Header header = jsonObject.containsKey(QuaternionStamped.FIELD_HEADER) ? Header .fromJsonObject(jsonObject .getJsonObject(QuaternionStamped.FIELD_HEADER)) : new Header(); Quaternion quaternion = jsonObject .containsKey(QuaternionStamped.FIELD_QUATERNION) ? Quaternion .fromJsonObject(jsonObject .getJsonObject(QuaternionStamped.FIELD_QUATERNION)) : new Quaternion(); return new QuaternionStamped(header, quaternion); } QuaternionStamped();  QuaternionStamped(Header header, Quaternion quaternion); Header getHeader(); Quaternion getQuaternion(); @Override QuaternionStamped clone(); static QuaternionStamped fromJsonString(String jsonString); static QuaternionStamped fromMessage(Message m); static QuaternionStamped fromJsonObject(JsonObject jsonObject); static final String FIELD_HEADER; static final String FIELD_QUATERNION; static final String TYPE; }### Answer:
@Test public void testFromJsonObject() { JsonObject jsonObject = Json .createObjectBuilder() .add(QuaternionStamped.FIELD_HEADER, p1.getHeader().toJsonObject()) .add(QuaternionStamped.FIELD_QUATERNION, p1.getQuaternion().toJsonObject()).build(); QuaternionStamped p = QuaternionStamped.fromJsonObject(jsonObject); assertEquals(p1.toString(), p.toString()); assertEquals(p1.toJsonObject(), p.toJsonObject()); assertEquals(p1.getMessageType(), p.getMessageType()); assertEquals(p1.getHeader(), p.getHeader()); assertEquals(p1.getQuaternion(), p.getQuaternion()); assertNotSame(p1, p); assertNotSame(p1.toString(), p.toString()); assertNotSame(p1.toJsonObject(), p.toJsonObject()); }