AtomNumberGenerator implements IGenerator<IAtomContainer> { @Override public IRenderingElement generate(IAtomContainer container, RendererModel model) { ElementGroup numbers = new ElementGroup(); if (!model.getParameter(WillDrawAtomNumbers.class).getValue()) return numbers; Vector2d offset = new Vector2d(this.offset.getValue().x, -this.offset.getValue().y); offset.scale(1 / model.getParameter(Scale.class).getValue()); int number = 1; for (IAtom atom : container.atoms()) { Point2d point = new Point2d(atom.getPoint2d()); point.add(offset); numbers.add(new TextElement(point.x, point.y, String.valueOf(number), colorByType.getValue() ? atomColorer .getValue().getAtomColor(atom) : textColor.getValue())); number++; } return numbers; }  @Override IRenderingElement generate(IAtomContainer container, RendererModel model); @Override List<IGeneratorParameter<?>> getParameters();  }
@Test public void testEmptyContainer() { IAtomContainer emptyContainer = super.builder.newInstance(IAtomContainer.class); IRenderingElement root = generator.generate(emptyContainer, model); List<IRenderingElement> elements = elementUtil.getAllSimpleElements(root); Assert.assertEquals(0, elements.size()); }