TextOutline { @Override public String toString() { final Rectangle2D bounds = getBounds(); final StringBuilder sb = new StringBuilder(25); sb.append(text); sb.append(" [x=").append(formatDouble(bounds.getX())); sb.append(", y=").append(formatDouble(bounds.getY())); sb.append(", w=").append(formatDouble(bounds.getWidth())); sb.append(", h=").append(formatDouble(bounds.getHeight())); sb.append(']'); return sb.toString(); } TextOutline(final String text, final Font font);   TextOutline(String text, GlyphVector glyphs); private  TextOutline(String text, GlyphVector glyphs, Shape outline, AffineTransform transform); @Override String toString(); static final FontRenderContext FONT_RENDER_CONTEXT; }
@Test public void testToString() throws Exception { TextOutline outline = new TextOutline("Cl", font); Rectangle2D bounds = outline.getBounds(); assertThat(outline.toString(), is("Cl [x=" + toString(bounds.getX()) + ", y=" + toString(bounds.getY()) + ", w=" + toString(bounds.getWidth()) + ", h=" + toString(bounds.getHeight()) + "]")); }