### Question:
TextWriter { public void write(Canvas graphics) { graphics.setColor(textColor); graphics.setFontStyle(FontStyle.Plain, TEXT_SIZE); Area textSize = graphics.measureText(text); findBreaksIfNotAlreadyEstablished(textSize); Rectangle bounds = graphics.calculateBounds(shape); for (int partIndex = 0; partIndex < parts.length; partIndex++) { String part = parts[partIndex]; Area partSize = graphics.measureText(part); int centeredX = bounds.origin.x + bounds.area.width / 2 - (partSize.width / 2); int centeredY = bounds.origin.y + bounds.area.height / 2 + (partSize.height / 2); int actualY = centeredY + yCorrection(partIndex, parts.length); graphics.drawString(part, new Coordinate(centeredX, actualY)); } } TextWriter(AgnosticShape shape, LineSuggestion lineSuggestion);  TextWriter(AgnosticShape shape); void write(Canvas graphics); void setText(String text); void setStroke(RGBColor stroke);  }### Answer:
@Test public void writesGivenText() throws Exception { writer.write(canvas); int expectedX = SHAPE_WIDTH / 2 - TEXT_WIDTH / 2; int expectedY = 53; verify(canvas).drawString("ABC", new Coordinate(expectedX, expectedY)); }
@Test public void usesGivenTextColor() throws Exception { writer.write(canvas); verify(canvas).setColor(RGBColor.Red); }
@Test public void setsFontForText() throws Exception { writer.write(canvas); verify(canvas).setFontStyle(FontStyle.Plain, 15); }