ReactionBoxGenerator implements IGenerator<IReaction> { @Override public IRenderingElement generate(IReaction reaction, RendererModel model) { if (!model.getParameter(ShowReactionBoxes.class).getValue()) return null; double separation = model.getParameter(BondLength.class).getValue() / model.getParameter(Scale.class).getValue(); Rectangle2D totalBounds = BoundsCalculator.calculateBounds(reaction); if (totalBounds == null) return null; ElementGroup diagram = new ElementGroup(); Color foregroundColor = model.getParameter(BasicSceneGenerator.ForegroundColor.class).getValue(); diagram.add(new RectangleElement(totalBounds.getMinX() - separation, totalBounds.getMinY() - separation, totalBounds.getMaxX() + separation, totalBounds.getMaxY() + separation, foregroundColor)); if (reaction.getID() != null) { diagram.add(new TextElement((totalBounds.getMinX() + totalBounds.getMaxX()) / 2, totalBounds.getMinY() - separation, reaction.getID(), foregroundColor)); } return diagram; }  @Override IRenderingElement generate(IReaction reaction, RendererModel model); @Override List<IGeneratorParameter<?>> getParameters();  }
@Test public void testEmptyReaction() { IReaction singleReaction = super.builder.newInstance(IReaction.class); IRenderingElement root = generator.generate(singleReaction, model); List<IRenderingElement> elements = elementUtil.getAllSimpleElements(root); Assert.assertEquals(1, elements.size()); }