ReactionArrowGenerator implements IGenerator<IReaction> { @Override public IRenderingElement generate(IReaction reaction, RendererModel model) { Rectangle2D totalBoundsReactants = BoundsCalculator.calculateBounds(reaction.getReactants()); Rectangle2D totalBoundsProducts = BoundsCalculator.calculateBounds(reaction.getProducts()); if (totalBoundsReactants == null || totalBoundsProducts == null) return null; double separation = model.getParameter(BondLength.class).getValue() / model.getParameter(Scale.class).getValue(); Color foregroundColor = model.getParameter(BasicSceneGenerator.ForegroundColor.class).getValue(); return new ArrowElement(totalBoundsReactants.getMaxX() + separation, totalBoundsReactants.getCenterY(), totalBoundsProducts.getMinX() - separation, totalBoundsReactants.getCenterY(), 1 / model.getParameter( Scale.class).getValue(), true, foregroundColor); }  @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()); }