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