StandardAtomGenerator { TextOutline positionSubscript(TextOutline label, TextOutline subscript) { final Rectangle2D hydrogenBounds = label.getBounds(); final Rectangle2D hydrogenCountBounds = subscript.getBounds(); subscript = subscript.translate((hydrogenBounds.getMaxX() + padding) - hydrogenCountBounds.getMinX(), (hydrogenBounds.getMaxY() + (hydrogenCountBounds.getHeight() / 2)) - hydrogenCountBounds.getMaxY()); return subscript; } StandardAtomGenerator(Font font); private  StandardAtomGenerator(Font font, double adjunctSpacing, double scriptSize);   }
@Test public void positionHydrogenCount() { TextOutline hydrogenCount = new TextOutline("2", font); TextOutline positioned = atomGenerator.positionSubscript(hydrogen, hydrogenCount); Rectangle2D hydrogenBounds = hydrogen.getBounds(); Rectangle2D hydrogenCountBounds = positioned.getBounds(); assertThat(hydrogenCountBounds.getMinX(), greaterThan(hydrogenBounds.getMinX())); assertThat(hydrogenCountBounds.getCenterY(), closeTo(hydrogenBounds.getMaxY(), 0.01)); }