### Question:
PoseArray extends Message { public static PoseArray fromJsonObject(JsonObject jsonObject) { Header header = jsonObject.containsKey(PoseArray.FIELD_HEADER) ? Header .fromJsonObject(jsonObject .getJsonObject(PoseArray.FIELD_HEADER)) : new Header(); JsonArray jsonPoses = jsonObject.getJsonArray(PoseArray.FIELD_POSES); if (jsonPoses != null) { Pose[] poses = new Pose[jsonPoses.size()]; for (int i = 0; i < poses.length; i++) { poses[i] = Pose.fromJsonObject(jsonPoses.getJsonObject(i)); } return new PoseArray(header, poses); } else { return new PoseArray(header, new Pose[] {}); } } PoseArray();  PoseArray(Header header, Pose[] poses); int size(); Pose get(int index); Pose[] getPoses(); Header getHeader(); @Override PoseArray clone(); static PoseArray fromJsonString(String jsonString); static PoseArray fromMessage(Message m); static PoseArray fromJsonObject(JsonObject jsonObject); static final String FIELD_HEADER; static final String FIELD_POSES; static final String TYPE; }### Answer:
@Test public void testFromJsonObject() { JsonArrayBuilder array = Json.createArrayBuilder(); for (Pose p : p1.getPoses()) { array.add(p.toJsonObject()); } JsonObject jsonObject = Json.createObjectBuilder() .add(PoseArray.FIELD_HEADER, p1.getHeader().toJsonObject()) .add(PoseArray.FIELD_POSES, array.build()).build(); PoseArray p = PoseArray.fromJsonObject(jsonObject); assertEquals(p1.toString(), p.toString()); assertEquals(p1.toJsonObject(), p.toJsonObject()); assertEquals(p1.getMessageType(), p.getMessageType()); assertEquals(p1.size(), p.size()); assertEquals(p1.getHeader(), p.getHeader()); assertTrue(Arrays.deepEquals(p1.getPoses(), p.getPoses())); assertNotSame(p1, p); assertNotSame(p1.toString(), p.toString()); assertNotSame(p1.toJsonObject(), p.toJsonObject()); }