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