### Question:
Fragment implements Iterable<Atom> { List<Atom> getAtomList() { return new ArrayList<Atom>(atomCollection); } Fragment(Element tokenEl);   Fragment(String type); @Override Iterator<Atom> iterator();  }### Answer:
@Test public void testConvertSpareValenciesToDoubleBonds() throws StructureBuildingException{ Fragment dhp = fm.buildSMILES("c1cCccC1"); FragmentTools.convertSpareValenciesToDoubleBonds(dhp); for(Atom a : dhp.getAtomList()) { assertEquals("All atoms have no sv", false, a.hasSpareValency()); } Fragment funnydiene = fm.buildSMILES("C(=C)C=C"); FragmentTools.convertSpareValenciesToDoubleBonds(funnydiene); for(Atom a : funnydiene.getAtomList()) { assertEquals("All atoms have no sv", false, a.hasSpareValency()); } Fragment naphthalene = fm.buildSMILES("c1cccc2ccccc12"); FragmentTools.convertSpareValenciesToDoubleBonds(naphthalene); for(Atom a : naphthalene.getAtomList()) { assertEquals("All atoms have no sv", false, a.hasSpareValency()); } Fragment pentalene = fm.buildSMILES("c12c(ccc1)ccc2"); for(Atom a : pentalene.getAtomList()) { assertEquals("All atoms have sv", true, a.hasSpareValency()); } FragmentTools.convertSpareValenciesToDoubleBonds(pentalene); for(Atom a : pentalene.getAtomList()) { assertEquals("All atoms have no sv", false, a.hasSpareValency()); } }
@Test public void testIsCharacteristicAtomHydroxy() throws StructureBuildingException{ List<Atom> phenolAtoms = fm.buildSMILES("Oc1ccccc1").getAtomList(); assertTrue(FragmentTools.isCharacteristicAtom(phenolAtoms.get(0))); for (int i = 1; i < phenolAtoms.size(); i++) { assertFalse(FragmentTools.isCharacteristicAtom(phenolAtoms.get(i))); } }