MappingGenerator implements IGenerator<IReaction> { @Override public IRenderingElement generate(IReaction reaction, RendererModel model) { if (!showAtomAtomMapping.getValue()) return null; ElementGroup elementGroup = new ElementGroup(); Color mappingColor = atomAtomMappingLineColor.getValue(); for (IMapping mapping : reaction.mappings()) { IAtom endPointA = (IAtom) mapping.getChemObject(0); IAtom endPointB = (IAtom) mapping.getChemObject(1); Point2d pointA = endPointA.getPoint2d(); Point2d pointB = endPointB.getPoint2d(); elementGroup.add(new LineElement(pointA.x, pointA.y, pointB.x, pointB.y, getWidthForMappingLine(model), mappingColor)); } return elementGroup; } MappingGenerator(); @Override IRenderingElement generate(IReaction reaction, RendererModel model); @Override List<IGeneratorParameter<?>> getParameters();  }
@Test public void testEmptyReaction() { IReaction emptyReaction = super.builder.newInstance(IReaction.class); IRenderingElement root = generator.generate(emptyReaction, model); List<IRenderingElement> elements = elementUtil.getAllSimpleElements(root); Assert.assertEquals(0, elements.size()); }