### Question:
MultiArrayLayout extends Message { public static MultiArrayLayout fromJsonObject(JsonObject jsonObject) { MultiArrayDimension[] dim = new MultiArrayDimension[] {}; JsonArray jsonDim = jsonObject.getJsonArray(MultiArrayLayout.FIELD_DIM); if (jsonDim != null) { dim = new MultiArrayDimension[jsonDim.size()]; for (int i = 0; i < dim.length; i++) { dim[i] = MultiArrayDimension.fromJsonObject(jsonDim .getJsonObject(i)); } } int dataOffset = jsonObject .containsKey(MultiArrayLayout.FIELD_DATA_OFFSET) ? Primitive .toUInt32(jsonObject.getJsonNumber( MultiArrayLayout.FIELD_DATA_OFFSET).longValue()) : 0; return new MultiArrayLayout(dim, dataOffset); } MultiArrayLayout();  MultiArrayLayout(MultiArrayDimension[] dim, int dataOffset); int size(); MultiArrayDimension get(int index); MultiArrayDimension[] getDim(); int getDataOffset(); @Override MultiArrayLayout clone(); static MultiArrayLayout fromJsonString(java.lang.String jsonString); static MultiArrayLayout fromMessage(Message m); static MultiArrayLayout fromJsonObject(JsonObject jsonObject); static final java.lang.String FIELD_DIM; static final java.lang.String FIELD_DATA_OFFSET; static final java.lang.String TYPE; }### Answer:
@Test public void testFromJsonObject() { JsonArrayBuilder array = Json.createArrayBuilder(); for (MultiArrayDimension p : m1.getDim()) { array.add(p.toJsonObject()); } JsonObject jsonObject = Json.createObjectBuilder() .add(MultiArrayLayout.FIELD_DIM, array.build()) .add(MultiArrayLayout.FIELD_DATA_OFFSET, m1.getDataOffset()) .build(); MultiArrayLayout p = MultiArrayLayout.fromJsonObject(jsonObject); assertEquals(m1.toString(), p.toString()); assertEquals(m1.toJsonObject(), p.toJsonObject()); assertEquals(m1.getMessageType(), p.getMessageType()); assertTrue(Arrays.deepEquals(m1.getDim(), p.getDim())); assertEquals(m1.getDataOffset(), p.getDataOffset()); assertNotSame(m1, p); assertNotSame(m1.toString(), p.toString()); assertNotSame(m1.toJsonObject(), p.toJsonObject()); assertEquals(m1.size(), p.size()); }