BasicAtomGenerator implements IGenerator<IAtomContainer> { public AtomSymbolElement generateElement(IAtom atom, int alignment, RendererModel model) { String text; if (atom instanceof IPseudoAtom) { text = ((IPseudoAtom) atom).getLabel(); } else { text = atom.getSymbol(); } return new AtomSymbolElement(atom.getPoint2d().x, atom.getPoint2d().y, text, atom.getFormalCharge(), atom.getImplicitHydrogenCount(), alignment, getAtomColor(atom, model)); } BasicAtomGenerator(); @Override IRenderingElement generate(IAtomContainer container, RendererModel model); IRenderingElement generate(IAtomContainer atomContainer, IAtom atom, RendererModel model); IRenderingElement generateCompactElement(IAtom atom, RendererModel model); AtomSymbolElement generateElement(IAtom atom, int alignment, RendererModel model); @Override List<IGeneratorParameter<?>> getParameters();  }
@Test public void generateElementTest() { IAtom atom = super.builder.newInstance(IAtom.class, "C"); atom.setPoint2d(new Point2d(2, 3)); atom.setImplicitHydrogenCount(0); int alignment = 1; AtomSymbolElement element = generator.generateElement(atom, alignment, model); Assert.assertEquals(atom.getPoint2d().x, element.xCoord, 0.01); Assert.assertEquals(atom.getPoint2d().y, element.yCoord, 0.01); Assert.assertEquals(atom.getSymbol(), element.text); Assert.assertEquals((int) atom.getFormalCharge(), element.formalCharge); Assert.assertEquals((int) atom.getImplicitHydrogenCount(), element.hydrogenCount); Assert.assertEquals(alignment, element.alignment); Assert.assertEquals(generator.getAtomColor(atom, model), element.color); }