### Question:
Pose2D extends Message { public static Pose2D fromJsonObject(JsonObject jsonObject) { double x = jsonObject.containsKey(Pose2D.FIELD_X) ? jsonObject .getJsonNumber(Pose2D.FIELD_X).doubleValue() : 0.0; double y = jsonObject.containsKey(Pose2D.FIELD_Y) ? jsonObject .getJsonNumber(Pose2D.FIELD_Y).doubleValue() : 0.0; double theta = jsonObject.containsKey(Pose2D.FIELD_THETA) ? jsonObject .getJsonNumber(Pose2D.FIELD_THETA).doubleValue() : 0.0; return new Pose2D(x, y, theta); } Pose2D();  Pose2D(double x, double y, double theta); double getX(); double getY(); double getTheta(); @Override Pose2D clone(); static Pose2D fromJsonString(String jsonString); static Pose2D fromMessage(Message m); static Pose2D fromJsonObject(JsonObject jsonObject); static final String FIELD_X; static final String FIELD_Y; static final String FIELD_THETA; static final String TYPE; }### Answer:
@Test public void testFromJsonObject() { JsonObject jsonObject = Json.createObjectBuilder() .add(Pose2D.FIELD_X, p1.getX()).add(Pose2D.FIELD_Y, p1.getY()) .add(Pose2D.FIELD_THETA, p1.getTheta()).build(); Pose2D p = Pose2D.fromJsonObject(jsonObject); assertEquals(p1.toString(), p.toString()); assertEquals(p1.toJsonObject(), p.toJsonObject()); assertEquals(p1.getMessageType(), p.getMessageType()); assertEquals(p1.getX(), p.getX(), 0); assertEquals(p1.getY(), p.getY(), 0); assertEquals(p1.getTheta(), p.getTheta(), 0); assertNotSame(p1, p); assertNotSame(p1.toString(), p.toString()); assertNotSame(p1.toJsonObject(), p.toJsonObject()); }