### Question:
BoundingBox extends Rectangle { public Polygon asPolygon() { Polygon polygon = new Polygon(); polygon.addPoint(x, y); polygon.addPoint(x, y + height); polygon.addPoint(x + width, y + height); polygon.addPoint(x + width, y); return polygon; } BoundingBox();  BoundingBox(int x0, int y0, int x1, int y1);  BoundingBox(Polygon polygon); Polygon asPolygon();  }### Answer:
@Test public void testToPolygon() { System.out.println("toPolygon"); Polygon expResult = new BoundingBox(0, 0, 20, 20).asPolygon(); BoundingBox instance = new BoundingBox(0, 0, 10, 20); instance.add(new BoundingBox(10, 10, 20, 20)); assertEquals(expResult.getBounds(), instance); }