@Test public void testWriteSMILESFile() throws Exception { StringWriter stringWriter = new StringWriter(); IAtomContainer benzene = TestMoleculeFactory.makeBenzene(); addImplicitHydrogens(benzene); SMILESWriter smilesWriter = new SMILESWriter(stringWriter); smilesWriter.write(benzene); smilesWriter.close(); Assert.assertTrue(stringWriter.toString().contains("C=C")); }
@Test public void testWriteAromatic() throws Exception { StringWriter stringWriter = new StringWriter(); IAtomContainer benzene = TestMoleculeFactory.makeBenzene(); addImplicitHydrogens(benzene); CDKHueckelAromaticityDetector.detectAromaticity(benzene); SMILESWriter smilesWriter = new SMILESWriter(stringWriter); Properties prop = new Properties(); prop.setProperty("UseAromaticity", "true"); PropertiesListener listener = new PropertiesListener(prop); smilesWriter.addChemObjectIOListener(listener); smilesWriter.customizeJob(); smilesWriter.write(benzene); smilesWriter.close(); Assert.assertFalse(stringWriter.toString().contains("C=C")); Assert.assertTrue(stringWriter.toString().contains("ccc")); }
@Test public void testAccepts() throws Exception { SMILESWriter reader = new SMILESWriter(); Assert.assertTrue(reader.accepts(AtomContainer.class)); Assert.assertTrue(reader.accepts(AtomContainerSet.class)); }