### Question:
Polygon { @Override public String toString() { final StringBuilder builder = new StringBuilder(Constant.HUNDRED).append(getClass().getSimpleName()) .append(" ["); for (int i = 0; i < npoints; i++) { builder.append(" p=").append(i + 1).append(" x=").append(xpoints[i]).append(", y=").append(ypoints[i]); } return builder.append("]").toString(); } Polygon(); void addPoint(double x, double y); void reset(); Area getArea(); boolean intersects(Area area); boolean contains(Area area); Collection<Line> getPoints(); @Override String toString();  }### Answer:
@Test void testToString() { final Polygon polygon = new Polygon(); assertEquals("Polygon []", polygon.toString()); polygon.addPoint(1.0, 2.0); assertEquals("Polygon [ p=1 x=1.0, y=2.0]", polygon.toString()); polygon.addPoint(3.0, 4.0); assertEquals("Polygon [ p=1 x=1.0, y=2.0 p=2 x=3.0, y=4.0]", polygon.toString()); }