### Question:
Rectangle implements Distributable { @Override public Map<String, Object> serialize() { Map<String, Object> theResult = new HashMap<>(); theResult.put("position", position.serialize()); theResult.put("size", size.serialize()); return theResult; } Rectangle();  Rectangle(Position aPosition, Size aSize); boolean contains(Position aPosition); Rectangle newPosition(Position aNewPosition); Rectangle newSize(Size aNewSize); @Override Map<String, Object> serialize(); static Rectangle deserialize(Map<String, Object> aSerializedData); final Position position; final Size size; }### Answer:
@Test public void testSerialize() throws Exception { Rectangle theRectangle = new Rectangle(); Map<String, Object> theData = theRectangle.serialize(); assertEquals(2, theData.size()); Map<String, Object> thePosition = (Map<String, Object>) theData.get("position"); assertEquals(2, thePosition.size()); Position theDePosition = Position.deserialize(thePosition); assertEquals(0, theDePosition.x, 0); assertEquals(0, theDePosition.y, 0); Map<String, Object> theSize = (Map<String, Object>) theData.get("size"); assertEquals(2, theSize.size()); Size theDeSize = Size.deserialize(theSize); assertEquals(Integer.MAX_VALUE, theDeSize.width); assertEquals(Integer.MAX_VALUE, theDeSize.height); }